Created
February 14, 2017 23:00
-
-
Save davidwallacejackson/f33966b3edd905bd642fbf50dbf4e8bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import ResizeSensor from require('css-element-queries/src/ResizeSensor') | |
| export default { | |
| // this will run in addition to any mounted() hook on the component | |
| // using the mixin | |
| mounted () { | |
| this.$resizeSensor = new ResizeSensor(this.$el, () => { | |
| // per the docs (https://vuejs.org/v2/api/#Vue-set), | |
| // this lets you add a reactive data property that wasn't specified in the component's | |
| // data() { } hook | |
| Vue.$set('clientWidth', this.$el.clientWidth) | |
| // then do that again for any other properties set by the library you want to track | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment