myth.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. },
  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. handleLoaded() {
  63. this.setData({ loaded: true })
  64. },
  65. handleProgress(event: WechatMiniprogram.TouchEvent) {
  66. console.log('progress', event.detail)
  67. const val = Number(event.detail) || 0
  68. this.setData({ progress: val })
  69. }
  70. })