添加组件等
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
|
||||
"t-link": "tdesign-miniprogram/link/link",
|
||||
"t-loading": "tdesign-miniprogram/loading/loading",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { base, defaultAvatarUrl } from '@/utils/config';
|
||||
import { login } from '@/utils/https';
|
||||
import { Subscribe } from '@/utils/subscribe';
|
||||
import { getCurrentPageRoute, isArray } from '@/utils/util';
|
||||
import { IIsLogin, Subscribe } from '@/utils/subscribe';
|
||||
import { getCurrentPageRoute, getStorage, isArray, setStorage } from '@/utils/util';
|
||||
// import { IStorage } from "@/utils/storage";
|
||||
|
||||
// const app = getApp();
|
||||
@@ -17,18 +17,21 @@ Component({
|
||||
hasTabBar: null,
|
||||
},
|
||||
|
||||
attached() {
|
||||
// this.setData({ isLogin: getStorage('isLogin') == 1 });
|
||||
// console.log('attached');
|
||||
Subscribe.on('isLogin', getCurrentPageRoute(), (data: any) => {
|
||||
// console.log(data);
|
||||
this.setData({ isLogin: data, loading: false });
|
||||
// console.log('监听到 isLogin 变化:');
|
||||
});
|
||||
},
|
||||
detached() {
|
||||
// console.log('detached');
|
||||
Subscribe.off('isLogin', getCurrentPageRoute());
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.setData({ isLogin: getStorage('isLogin') == 1 });
|
||||
// console.log('attached');
|
||||
Subscribe.on<IIsLogin>('isLogin', getCurrentPageRoute(), (data) => {
|
||||
// console.log(data);
|
||||
setStorage('isLogin', data ? 1 : 0);
|
||||
this.setData({ isLogin: data, loading: false });
|
||||
// console.log('监听到 isLogin 变化:');
|
||||
});
|
||||
},
|
||||
detached() {
|
||||
// console.log('detached');
|
||||
Subscribe.off('isLogin', getCurrentPageRoute());
|
||||
},
|
||||
},
|
||||
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user