mirror of
https://github.com/yangzongzhuan/RuoYi-App.git
synced 2025-09-27 22:52:40 +00:00
使用Pinia代替Vuex进行数据存储
This commit is contained in:
26
App.vue
26
App.vue
@@ -1,7 +1,9 @@
|
||||
<script setup>
|
||||
import config from './config'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { useConfigStore } from '@/store'
|
||||
import { getCurrentInstance } from "vue"
|
||||
import { onLaunch } from '@dcloudio/uni-app'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { getCurrentInstance } from "vue"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
@@ -10,29 +12,25 @@
|
||||
})
|
||||
|
||||
// 初始化应用
|
||||
function initApp() {
|
||||
function initApp() {
|
||||
// 初始化应用配置
|
||||
initConfig()
|
||||
// 检查用户登录状态
|
||||
//#ifdef H5
|
||||
checkLogin()
|
||||
//#endif
|
||||
}
|
||||
|
||||
function initConfig() {
|
||||
useConfigStore().setConfig(config)
|
||||
}
|
||||
|
||||
function checkLogin() {
|
||||
if (!getToken()) {
|
||||
proxy.$tab.reLaunch('/pages/login')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import config from './config'
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
this.globalData.config = config
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/static/scss/index.scss'
|
||||
|
Reference in New Issue
Block a user