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); } } }
react如何利用addEventListener监听关闭Modal弹框
上面是“vuejs监听当前浏览器大小执行”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1801.html
workflows工作流
图生图生成动漫效果ComfyUI工作流
海中一头鲸鱼ComfyUI工作流
图生图工作流:一键转换成高清动漫照片
奇幻绘画风格:一只巨大蜗牛ComfyUI工作流
一只由粉色水晶与羽毛组成的巨型高跟鞋
哈利波特魔法ComfyUI工作流
汉堡里的一只毛茸茸的小猫ComfyUI工作流
一辆停在混凝土墙前运动型SUV捷豹概念车
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!