yunser-ui-vue
Version:
material design ui for vue2
20 lines (19 loc) • 454 B
JavaScript
export default {
mounted () {
this.$bindResize()
},
methods: {
$bindResize () {
this._handleResize = (e) => {
if (this.onResize) this.onResize()
}
typeof window !== 'undefined' && window.addEventListener('resize', this._handleResize)
},
$unBindResize () {
if (this._handleResize) window.removeEventListener('resize', this._handleResize)
}
},
beforeDestroy () {
this.$unBindResize()
}
}