data(){ return { screenWidth: document.body.clientWidth } }, mounted() { //监听浏览器大小 let that = this; window.addEventListener("resize", function() { return (() => { window.screenWidth = document.body.clientWidth; that.screenWidth = window.screenWidth; console.log("that.screenWidth", that.screenWidth); })(); }); }, watch: { //防止因为频繁触发 resize 函数,导致页面很卡的问题 screenWidth(val) { if (!this.timer) { this.screenWidth = val; this.timer = true; let that = this; setTimeout(function() { that.reload(); that.timer = false; }, 400); } } }
悟空浏览器的秘密:如何轻松下载小说和视频?网页版入口大公开!
上面是“vuejs监听当前浏览器大小执行”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1801.html
workflows工作流
一只沮丧的卡通小丑鱼ComfyUI工作流
泰坦尼克号桌面壁纸上ComfyUI工作流
一位身着传统红色服装的女战士ComfyUI工作流
一个超现实和超现实的场景,在森林中心有一座蛇形的房子
冬天的严寒里红梅枝上停留着一只鸟
在地铁站里一个迷茫的非主流姑娘
一个白色的咖啡杯,蒸汽从杯子里冒出来
一只由水晶制成的蜂鸟
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!