scaner.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // pages/scaner/scaner.ts
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. width: 300,
  8. height: 300,
  9. renderWidth: 300,
  10. renderHeight: 300,
  11. loaded: false,
  12. isShowGuide: true
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad() {
  18. const info = wx.getSystemInfoSync();
  19. const width = info.windowWidth;
  20. const height = info.windowHeight;
  21. const dpi = info.pixelRatio;
  22. this.setData({
  23. width, height,
  24. renderWidth: width * dpi,
  25. renderHeight: height * dpi
  26. });
  27. },
  28. /**
  29. * 生命周期函数--监听页面初次渲染完成
  30. */
  31. onReady() {
  32. },
  33. /**
  34. * 生命周期函数--监听页面显示
  35. */
  36. onShow() {
  37. },
  38. /**
  39. * 生命周期函数--监听页面隐藏
  40. */
  41. onHide() {
  42. },
  43. /**
  44. * 生命周期函数--监听页面卸载
  45. */
  46. onUnload() {
  47. },
  48. /**
  49. * 页面相关事件处理函数--监听用户下拉动作
  50. */
  51. onPullDownRefresh() {
  52. },
  53. /**
  54. * 页面上拉触底事件的处理函数
  55. */
  56. onReachBottom() {
  57. },
  58. /**
  59. * 用户点击右上角分享
  60. */
  61. onShareAppMessage() {
  62. },
  63. handleProgress(event: WechatMiniprogram.TouchEvent) {
  64. console.log('progress', event.detail)
  65. const val = Number(event.detail) || 0
  66. this.setData({ progress: val })
  67. },
  68. handleHideGuide() {
  69. this.setData({ isShowGuide: false })
  70. },
  71. handleLoaded() {
  72. this.setData({ loaded: true })
  73. }
  74. })