1
This commit is contained in:
@@ -50,10 +50,19 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const hasToken = (() => { try { return !!uni.getStorageSync('TOKEN') } catch(e){ return false } })()
|
||||
if (!hasToken) {
|
||||
this.items = []
|
||||
this.categories = []
|
||||
uni.showToast({ title: '请登录使用该功能', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.fetchCategories()
|
||||
this.reload()
|
||||
},
|
||||
onShow() {
|
||||
const hasToken = (() => { try { return !!uni.getStorageSync('TOKEN') } catch(e){ return false } })()
|
||||
if (!hasToken) return
|
||||
// 从创建/编辑页返回时,确保刷新最新列表
|
||||
this.reload()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user