mirror of
https://github.com/yangzongzhuan/RuoYi-App.git
synced 2025-09-27 22:52:40 +00:00
update vue3
This commit is contained in:
37
App.vue
37
App.vue
@@ -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"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
onLaunch(() => {
|
||||||
|
initApp()
|
||||||
|
})
|
||||||
|
|
||||||
export default {
|
|
||||||
onLaunch: function() {
|
|
||||||
this.initApp()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 初始化应用
|
// 初始化应用
|
||||||
initApp() {
|
function initApp() {
|
||||||
// 初始化应用配置
|
// 初始化应用配置
|
||||||
this.initConfig()
|
initConfig()
|
||||||
// 检查用户登录状态
|
// 检查用户登录状态
|
||||||
//#ifdef H5
|
//#ifdef H5
|
||||||
this.checkLogin()
|
checkLogin()
|
||||||
//#endif
|
//#endif
|
||||||
},
|
}
|
||||||
initConfig() {
|
|
||||||
this.globalData.config = config
|
function initConfig() {
|
||||||
},
|
getApp().globalData.config = config
|
||||||
checkLogin() {
|
}
|
||||||
|
|
||||||
|
function checkLogin() {
|
||||||
if (!getToken()) {
|
if (!getToken()) {
|
||||||
this.$tab.reLaunch('/pages/login')
|
proxy.$tab.reLaunch('/pages/login')
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user