更新
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
import { checkLogin, isLogin } from '@/utils/auth.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 记录该页面是否已检查过登录状态
|
||||
_pageAuthChecked: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时检查登录状态
|
||||
this.checkAuth()
|
||||
},
|
||||
onShow() {
|
||||
// 页面显示时检查登录状态
|
||||
this.checkAuth()
|
||||
// 页面显示时检查登录状态,但避免重复检查
|
||||
if (!this._pageAuthChecked) {
|
||||
this.checkAuth()
|
||||
this._pageAuthChecked = true
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
// 页面隐藏时重置检查标志,下次显示时重新检查
|
||||
this._pageAuthChecked = false
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user