37 lines
918 B
Vue
37 lines
918 B
Vue
<script>
|
|
export default {
|
|
onLaunch: function() {
|
|
// #ifdef APP-PLUS
|
|
plus.screen.lockOrientation('landscape-primary');
|
|
// plus.navigator.setFullscreen(true);
|
|
// #endif
|
|
this.setRem();
|
|
window.addEventListener('resize', this.setRem);
|
|
},
|
|
onHide: function() {
|
|
console.log('App Hide')
|
|
},
|
|
onUnload() {
|
|
// #ifdef APP-PLUS
|
|
plus.screen.lockOrientation('landscape-primary');
|
|
// #endif
|
|
},
|
|
methods: {
|
|
setRem() {
|
|
const screenWidth = uni.getSystemInfoSync().screenWidth;
|
|
const baseWidth = 1920; // 设计稿宽度
|
|
const rem = screenWidth / baseWidth * 100; // 基于设计稿计算 rem
|
|
uni.setStorageSync('rem', rem);
|
|
document.documentElement.style.fontSize = `${rem}px`;
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/*每个页面公共css */
|
|
@import '@/common/style/reset.css';
|
|
@import '@/common/style/iconfont.css';
|
|
@import '@/common/style/layout.css';
|
|
</style>
|