兼容vue3模式获取config

master
RuoYi 8 months ago
parent 0ecc627938
commit fd97380edb

@ -1,37 +1,39 @@
<script setup>
import { onLaunch } from '@dcloudio/uni-app'
import config from './config'
import store from '@/store'
import { getToken } from '@/utils/auth'
import { getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
<script setup>
import { onLaunch } from '@dcloudio/uni-app'
import { getToken } from '@/utils/auth'
import { getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
onLaunch(() => {
initApp()
})
//
function initApp() {
//
initConfig()
//
//#ifdef H5
checkLogin()
//#endif
}
function initConfig() {
getApp().globalData.config = config
}
function checkLogin() {
if (!getToken()) {
proxy.$tab.reLaunch('/pages/login')
}
}
})
//
function initApp() {
//
//#ifdef H5
checkLogin()
//#endif
}
function checkLogin() {
if (!getToken()) {
proxy.$tab.reLaunch('/pages/login')
}
}
</script>
<style lang="scss">
@import '@/static/scss/index.scss'
<script>
import config from './config'
export default {
onLaunch: function() {
this.globalData.config = config
}
}
</script>
<style lang="scss">
@import '@/static/scss/index.scss'
</style>

Loading…
Cancel
Save