修复自适应的返回异常
This commit is contained in:
@@ -15,7 +15,8 @@ export default {
|
||||
height: 1080
|
||||
},
|
||||
width: 0,
|
||||
height: 0
|
||||
height: 0,
|
||||
observer: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -37,7 +38,11 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(this.initSize)
|
||||
window.onresize = () => this.$nextTick(this.initSize)
|
||||
this.observer = new ResizeObserver(this.initSize)
|
||||
this.observer.observe(this.$el)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.observer?.disconnect()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user