update vue3

This commit is contained in:
RuoYi
2025-04-13 09:49:11 +08:00
parent 03e023cbc4
commit 0ecc627938

49
App.vue
View File

@@ -1,30 +1,33 @@
<script> <script setup>
import { onLaunch } from '@dcloudio/uni-app'
import config from './config' import config from './config'
import store from '@/store' import store from '@/store'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { getCurrentInstance } from "vue"
export default { const { proxy } = getCurrentInstance()
onLaunch: function() {
this.initApp() onLaunch(() => {
}, initApp()
methods: { })
// 初始化应用
initApp() { // 初始化应用
// 初始化应用配置 function initApp() {
this.initConfig() // 初始化应用配置
// 检查用户登录状态 initConfig()
//#ifdef H5 // 检查用户登录状态
this.checkLogin() //#ifdef H5
//#endif checkLogin()
}, //#endif
initConfig() { }
this.globalData.config = config
}, function initConfig() {
checkLogin() { getApp().globalData.config = config
if (!getToken()) { }
this.$tab.reLaunch('/pages/login')
} function checkLogin() {
} if (!getToken()) {
proxy.$tab.reLaunch('/pages/login')
} }
} }
</script> </script>