纽迪希亚平板
This commit is contained in:
36
App.vue
Normal file
36
App.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user