wujingjing
2024-08-12 a2410e6dd7dfe33133e709e43b06b3bb7852d4b1
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
import { clearStorage,getStorage } from "@/utils/storage"
const app = getApp();
// pages/my/my.ts
Component({
 
  /**
   * 页面的初始数据
   */
  data: {
    userName:getStorage('username'),
    phoneNumber: app.globalData.user.phoneNum
  },
  methods:{
    logout(){
      clearStorage();
      wx.reLaunch({
        url: '/pages/login/login',
      })
    }
  },
 
  pageLifetimes: {
    show() {
      this.setData({
        userName:getStorage('username'),
        phoneNumber:app.globalData.user.phoneNum
      })
      if (typeof this.getTabBar === 'function' &&
        this.getTabBar()) {
        this.getTabBar().setData({
          selected: 2
        })
      }
    }
  }
})