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工作流
爱因斯坦在做实验3d动漫ComfyUI工作流
一只黑色的小猫在童话森林里嗅着一朵发光的外星花
沙漠里一只红黑相间的蝎子
哈利波特魔法ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

一个包含老黄历、佛历、道历、星宿等数据的日历网站
css3搭积木叠加图形
canvas空间文本射线
js实现table表格动态新增行和列表
做一个好玩的时钟翻牌效果
纯css3绘制的小鸟
HTML5 Canvas 刻度尺














