export default { data() { return { screenWidth: '', screenHeight: '' }; }, mounted() { this.screenWidth = document.body.clientWidth; this.screenHeight = document.body.clientHeight; window.onresize = () => { return (() => { this.screenWidth = document.body.clientWidth; this.screenHeight = document.body.clientHeight; })(); }; } }
Vue2监听当前窗口大小的变化
最新推荐文章于 2023-12-27 15:10:37 发布