spa/frontend/user-miniprogram/App.vue

38 lines
629 B
Vue

<template>
<view id="app">
<!-- 应用入口 -->
</view>
</template>
<script>
export default {
onLaunch: function() {
console.log('App Launch')
// 应用启动时的逻辑
this.checkLogin()
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
methods: {
checkLogin() {
// 检查登录状态
const token = uni.getStorageSync('token')
if (!token) {
// 未登录,跳转到登录页
uni.reLaunch({
url: '/pages/login/login'
})
}
}
}
}
</script>
<style>
/*每个页面公共css */
@import url("./static/css/common.css");
</style>