mounted() { let self = this; this.screenWidth = document.body.clientWidth; //767 this.screenHeight = document.body.clientHeight;//350 window.onresize = () => { return (() => { this.screenWidth = document.body.clientWidth; this.screenHeight = document.body.clientHeight; if(this.screenWidth<=767 & this.screenHeight<=350) { self.seen = true; self.peen = false; $(document).ready(function(){ $(".homeMenu").click(function(){ $(".panel").slideToggle("fast") }); }); }else{ self.seen = false; self.peen = true; } })(); }; }
vue.js实时监听浏览器界面大小改动的办法
最新推荐文章于 2024-06-06 13:06:13 发布