index.ts 714 B

123456789101112131415161718192021222324252627282930313233
  1. // index.ts
  2. // 获取应用实例
  3. const app = getApp<IAppOption>()
  4. var mixins = require('../../utils/mixins')
  5. Page({
  6. mixins: [mixins],
  7. data: {
  8. motto: 'Hello World',
  9. userInfo: {},
  10. hasUserInfo: false,
  11. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  12. canIUseGetUserProfile: false,
  13. canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
  14. },
  15. // 事件处理函数
  16. toPerson() {
  17. wx.navigateTo({
  18. url: '../person/index',
  19. })
  20. },
  21. onLoad() {
  22. // @ts-ignore
  23. if (wx.getUserProfile) {
  24. this.setData({
  25. canIUseGetUserProfile: true
  26. })
  27. }
  28. },
  29. })