loading.vue
671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
uni.showLoading({
mask: true
})
let userInfo = uni.$storage.get('userInfo')
if (userInfo) {
// 先隐藏 loading 再跳转,避免生产环境下 loading 无法自动关闭
uni.hideLoading()
uni.reLaunch({
url: '/pages/equity/index'
})
} else this.toLogin()
},
methods: {
toLogin () {
uni.hideLoading()
uni.$storage.rm("userInfo")
uni.reLaunch({
url: '/pages/common/login'
})
}
}
}
</script>
<style scoped lang='scss'>
</style>