vibrate.js 787 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '振动',
  5. path: 'packageAPI/pages/device/vibrate/vibrate'
  6. }
  7. },
  8. vibrateShort() {
  9. wx.vibrateShort({
  10. success(res) {
  11. console.log(res)
  12. },
  13. fail(err) {
  14. console.error(err)
  15. },
  16. complete() {
  17. console.log('completed')
  18. }
  19. })
  20. },
  21. vibrateLong() {
  22. wx.vibrateLong({
  23. success(res) {
  24. console.log(res)
  25. },
  26. fail(err) {
  27. console.error(err)
  28. },
  29. complete() {
  30. console.log('completed')
  31. }
  32. })
  33. },
  34. onLoad() {
  35. this.setData({
  36. theme: wx.getSystemInfoSync().theme || 'light'
  37. })
  38. if (wx.onThemeChange) {
  39. wx.onThemeChange(({theme}) => {
  40. this.setData({theme})
  41. })
  42. }
  43. }
  44. })