mine.js 786 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const app = getApp();
  2. Page({
  3. data: {
  4. images: {
  5. background: '/static_file/background.png'
  6. },
  7. userInfo: {
  8. name: '',
  9. id: '',
  10. address: ''
  11. }
  12. },
  13. // 页面加载时执行
  14. onLoad: function(options) {
  15. this.updateUserInfo();
  16. },
  17. onShow: function() {
  18. this.updateUserInfo();
  19. },
  20. // 更新用户信息的方法
  21. updateUserInfo: function() {
  22. this.setData({
  23. userInfo: {
  24. name: app.globalData.currentAccountInfo.username,
  25. id: app.globalData.currentAccountInfo.usernumber,
  26. address: app.globalData.currentAccountInfo.address
  27. }
  28. });
  29. },
  30. // 导航到指定页面
  31. navigateTo: function(e) {
  32. const url = e.currentTarget.dataset.url;
  33. wx.navigateTo({
  34. url: url
  35. });
  36. }
  37. })