dunhuang.ts 1.5 KB

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