capture-screen.js 521 B

1234567891011121314151617181920212223242526272829
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '用户截屏事件',
  5. path: 'packageAPI/pages/device/capture-screen/capture-screen'
  6. }
  7. },
  8. data: {
  9. theme: 'light',
  10. captured: false,
  11. },
  12. onLoad() {
  13. this.setData({
  14. theme: wx.getSystemInfoSync().theme || 'light'
  15. })
  16. if (wx.onThemeChange) {
  17. wx.onThemeChange(({theme}) => {
  18. this.setData({theme})
  19. })
  20. }
  21. wx.onUserCaptureScreen(() => {
  22. this.setData({
  23. captured: true
  24. })
  25. })
  26. }
  27. })