<template>
<div ref="box"></div>
</template>
resize事件监听窗口变化
mounted(){
window.addEventListener('resize', this.changeBox, true)
},
methods: {
changeBox(){
left = this.$refs.box.getBoundingClientRect().left
}
}
<template>
<div ref="box"></div>
</template>
resize事件监听窗口变化
mounted(){
window.addEventListener('resize', this.changeBox, true)
},
methods: {
changeBox(){
left = this.$refs.box.getBoundingClientRect().left
}
}