1、新建pc.js文件
// #ifdef H5
(function () {
var u = navigator.userAgent,
w = window.innerWidth;
if (!u.match(/AppleWebKit.*Mobile.*/) || u.indexOf('iPad') > -1) {
window.innerWidth = 750 * (w / 1920);
window.onload = function () {
window.innerWidth = w;
};
}
})();
// #endif
2、在APP.vue中,新增样式
<style lang="scss">
body {
max-width: 1080rpx; //最大宽度自己可以调整
margin: auto !important;
}
</style>
3、在main.js中引入
import './common/services/pc';