Created
November 16, 2018 16:36
-
-
Save betweenbrain/275ca245ab0a20b6966ecaf088776a99 to your computer and use it in GitHub Desktop.
Vue.js watch element by ref
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import Foo from 'bar'; | |
export default { | |
name: 'Slider', | |
mounted() { | |
this.$watch( | |
() => { | |
return this.$refs.baz.currentValue; | |
}, | |
(val) => { | |
console.log(val); | |
} | |
); | |
}, | |
render() { | |
return ( | |
<div> | |
<Foo ref="baz" /> | |
</div> | |
); | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment