Created
September 7, 2018 19:56
-
-
Save rubenestevao/7c2465e584745a10205ddf07ccc58923 to your computer and use it in GitHub Desktop.
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> | |
/** | |
* @link https://jsfiddle.net/adamwathan/2juusxqo/ | |
*/ | |
const erd = elementResizeDetectorMaker({ strategy: 'scroll' }); | |
export default { | |
data() { | |
return { | |
width: null, | |
height: null, | |
}; | |
}, | |
mounted() { | |
erd.listenTo(this.$el, (el) => { | |
this.width = el.offsetWidth; | |
this.height = el.offsetHeight; | |
}); | |
}, | |
render() { | |
return this.$scopedSlots.default({ | |
width: this.width, | |
height: this.height, | |
}); | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment