scaner.ts 1.4 KB

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