choose-address.js 620 B

123456789101112131415161718192021222324252627282930313233343536
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '收货地址',
  5. path: 'packageAPI/pages/api/choose-address/choose-address'
  6. }
  7. },
  8. data: {
  9. theme: 'light',
  10. addressInfo: null
  11. },
  12. chooseAddress() {
  13. wx.chooseAddress({
  14. success: (res) => {
  15. this.setData({
  16. addressInfo: res
  17. })
  18. },
  19. fail(err) {
  20. console.log(err)
  21. }
  22. })
  23. },
  24. onLoad() {
  25. this.setData({
  26. theme: wx.getSystemInfoSync().theme || 'light'
  27. })
  28. if (wx.onThemeChange) {
  29. wx.onThemeChange(({theme}) => {
  30. this.setData({theme})
  31. })
  32. }
  33. }
  34. })