share-button.js 651 B

12345678910111213141516171819202122232425262728
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '转发按钮',
  5. path: 'packageAPI/pages/api/share-button/share-button'
  6. }
  7. },
  8. handleTapShareButton() {
  9. if (!((typeof wx.canIUse === 'function') && wx.canIUse('button.open-type.share'))) {
  10. wx.showModal({
  11. title: '当前版本不支持转发按钮',
  12. content: '请升级至最新版本微信客户端',
  13. showCancel: false
  14. })
  15. }
  16. },
  17. onLoad() {
  18. this.setData({
  19. theme: wx.getSystemInfoSync().theme || 'light'
  20. })
  21. if (wx.onThemeChange) {
  22. wx.onThemeChange(({theme}) => {
  23. this.setData({theme})
  24. })
  25. }
  26. }
  27. })