//必须放在mounted中,因为放在created中未获取dom节点
mounted(){
//等待dom渲染完毕再加载
this.$nextTick(()=>{
var p = navigator.platform;
let mac = p.indexOf("Mac") === 0;
let x11 = (p === "X11") || (p.indexOf("Linux") === 0);
//判断当前系统
if(p.indexOf("Win") === 0||mac||x11){
//监听缩放
window.addEventListener("resize", ()=> {
this.commonSySize();
})
//监听页面加载
window.addEventListener('load',()=>{
this.commonSySize();
})
}
});
},
methods:{
//公共使用控制页面大小收缩
commonSySize(){
let idTag=document.body;
if(idTag.offsetWidth<808){
this.perSonCenterShow=false;
}
if(idTag.offsetWidth<678){
this.kcSecondDhShow=false;
}else{
this.kcSecondDhShow=true;
}
if(idTag.offsetWidth>=809){
this.kcSecondDhShow=true;
this.perSonCenterShow=true;
}
},
}