feat: 分端显示
This commit is contained in:
12
src/App.vue
12
src/App.vue
@@ -1,10 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
|
||||
import { navigateToInterceptor } from '@/router/interceptor'
|
||||
import { useUserStore, ClientType } from '@/store/user'
|
||||
import { tabbarStore } from '@/tabbar/store'
|
||||
|
||||
onLaunch((options) => {
|
||||
console.log('App.vue onLaunch', options)
|
||||
|
||||
// 根据已存储的客户端类型恢复 tabbar 配置
|
||||
const userStore = useUserStore()
|
||||
if (userStore.clientType && userStore.clientType !== ClientType.USER) {
|
||||
tabbarStore.setTabbarByClientType(userStore.clientType)
|
||||
console.log('Restored tabbar for clientType:', userStore.clientType)
|
||||
}
|
||||
})
|
||||
|
||||
onShow((options) => {
|
||||
console.log('App.vue onShow', options)
|
||||
// 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等
|
||||
@@ -16,6 +26,7 @@ onShow((options) => {
|
||||
navigateToInterceptor.invoke({ url: '/' })
|
||||
}
|
||||
})
|
||||
|
||||
onHide(() => {
|
||||
console.log('App Hide')
|
||||
})
|
||||
@@ -24,3 +35,4 @@ onHide(() => {
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user