判断是PC还是移动,渲染不同class,2022/5/31pm
<div :class="isPc && screenWidthNo >= 1000 ? 'detail' : 'mobiel'" >
export default {
data() {
return {
screenWidthNo:'',
}
},
mounted() {
this.getData()
this.screenWidthNo = document.body.clientWidth;
window.onresize = () => {
return (() => {
this.screenWidthNo = document.body.clientWidth;
})();
};
},
}
max-width: 1200px;
margin-left: auto;
margin-right: auto;
display: flex;
flex-wrap: wrap-reverse;
justify-content: space-around;