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工作流一
1个粉红色头发可爱的女孩ComfyUI工作流
ai图片扩大comfyui工作流
一个超现实和超现实的场景,在森林中心有一座蛇形的房子
一张超现实主义美女照片ComfyUI工作流
一只可爱的草莓味冰淇淋卷筒
一个女孩骑着一辆生锈的现代摩托车
一个美丽的女孩穿着花瓣做的衣服
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!