Files
uni-pda/App.vue
T
2026-07-03 11:45:16 +08:00

50 lines
1.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script>
export default {
onLaunch() {
console.log('App Launch')
// 🔥 初始化字体缩放(使用 Vuex)
this.$store.dispatch('font/initFontScale')
// 从本地存储恢复登录状态
const token = uni.getStorageSync('token')
const userInfo = uni.getStorageSync('userInfo')
const deviceUuid = uni.getStorageSync('deviceUuid')
if (token) {
this.$store.commit('user/SET_TOKEN', token)
this.$store.commit('user/SET_DEVICE_UUID', deviceUuid || '')
if (userInfo) {
this.$store.commit('user/SET_USER_INFO', userInfo)
}
this.$store.commit('user/SET_LOGIN', true)
// 启动 Token 自动续期定时器
this.$store.dispatch('user/startTokenRefresh')
// 初始化打印机配置
this.$store.dispatch('print/initPrinterConfig')
// 初始化扫码模式配置
this.$store.dispatch('scan/initScanMode')
}
}
}
</script>
<style lang="scss">
@import './styles/index.scss';
// 引入字体图标
@import './static/iconfont/font_5178893_r4lrriz2ngn/iconfont.css';
page {
height: 100%;
/*
* 使用 rem 方案后,不需要设置 font-size
* 所有元素使用 rem 单位,会自动相对于根字体大小计算
* 根字体大小由 JavaScript 动态设置(document.documentElement.style.fontSize
*/
}
</style>