当前位置:   article > 正文

微信小程序 画图 canvas 进阶版_wxs canvas

wxs canvas

微信小程序 canvas 页面布局效果

 实现功能:

1、落笔的时候开始计时

2、色卡:点击色卡,选择画笔的颜色

3、文本:文本可以选择格式

4、画笔:画笔粗细和透明度选择

5、把画布生成图片,并上传到服务器

借助mini-color-picker组件实现色卡的选择

  1. <view class="page_view" style="margin-top:{{navBarHeight*2+0}}rpx;">
  2. <canvas canvas-id="myCanvas" class="canvasBox _box-shadow" bindtouchstart="start" bindtouchmove="move"></canvas>
  3. <view class="bottomBox" bindtap="closeDialog">
  4. <view class="brushDialog" hidden="{{brushDialogHidden}}" catchtap="preventevents">
  5. <view class="brushWidthBox">
  6. <image bindtap="checkBrush" data-value="{{item.value}}" wx:for="{{brushList}}" wx:key="index" src="../../images/img/{{item.url}}" mode="heightFix"/>
  7. </view>
  8. <view class="sliderBg" style="margin: 20rpx 30rpx;">
  9. <view class="setBgOpacity" style="background-image: linear-gradient(to right, {{tools.setOpacticy(strokeStyle, 0)}}, {{tools.setOpacticy(strokeStyle, 1)}});"></view>
  10. <slider value="{{globalAlpha}}" class="globalAlphaBox" bindchanging="sliderchange" bindchange="sliderchange" min="0" max="1" step="0.01" block-size="20" activeColor="rgba(255,255,255,0)" backgroundColor="rgba(255,255,255,0)"/>
  11. </view>
  12. </view>
  13. <view class="canvasToll _box-shadow">
  14. <image src="../../images/img/colorSwatches.png" mode="heightFix" bindtap="openColorDialog" />
  15. <image src="../../images/img/text.png" mode="heightFix" bindtap="chengeText" />
  16. <!-- <image src="../../images/img/bucket.png" mode="heightFix"/> -->
  17. <image src="../../images/img/brush.png" mode="heightFix" catchtap="openBrushDialog"/>
  18. </view>
  19. <view class="btnBox">
  20. <button hidden="{{!hiddenFormat}}" class="btn" bindtap="submit">确定完成</button>
  21. </view>
  22. </view>
  23. <input focus="{{focus}}" value="{{inputValue}}" type="text" class="textInput" bindinput="bindKeyInput" bindconfirm="confirmInput" hidden="{{hiddenFormat}}" />
  24. </view>
  25. <view class="countdownBox" style="top:{{navBarHeight*2+100}}rpx;">
  26. <image src="/images/img/alarmClock.png" mode="heightFix"/>{{timerValue.text}}
  27. </view>
  28. <view class="textFormat" hidden="{{hiddenFormat}}" bindtap="openFormat">格式</view>
  29. <view class="maskBackground" wx:if="{{showDialog}}" bindtap="hideMask">
  30. <view class="pickerBox" catchtap="preventevents" style="background-color: {{showDialog == 2 ? '#fff' : '#F4F6F4'}};">
  31. <view class="maskTitle">
  32. <view class="">{{showDialog == 2 ? '格式' : '颜色'}}</view>
  33. <image src="../../images/img/guan.png" mode="widthFix" class="guanImg" bindtap="hideMask" />
  34. </view>
  35. <view wx:if="{{showDialog == 2}}" class="formatContent">
  36. <view wx:for="{{formatList}}" wx:key="index" bindtap="changeFormat" data-value="{{item}}">{{item}}</view>
  37. </view>
  38. <view wx:if="{{showDialog == 1}}" class="colorContent">
  39. <color-picker bindchangeColor="pickColor" initColor="{{strokeStyle}}" />
  40. <view class="opticyLabel">不透明度</view>
  41. <view class="sliderBox">
  42. <view class="sliderBg">
  43. <view class="setBgOpacity" style="background-image: linear-gradient(to right, {{tools.setOpacticy(strokeStyle, 0)}}, {{tools.setOpacticy(strokeStyle, 1)}});"></view>
  44. <slider value="{{globalAlpha}}" class="globalAlphaBoxInColor" bindchanging="sliderchange" bindchange="sliderchange" min="0" max="1" step="0.01" block-size="28" activeColor="rgba(255,255,255,0)" backgroundColor="rgba(255,255,255,0)" />
  45. </view>
  46. <view class="slideValue _box-shadow">{{tools.integer(globalAlpha * 100)}}%</view>
  47. </view>
  48. <view class="colorBottomBox">
  49. <view class="activeColorBox" style="background-color: {{strokeStyle}};opacity: {{globalAlpha}};"></view>
  50. <view class="activeColorArr">
  51. <view wx:for="{{activeColorList}}" wx:key="index" class="activeColor _box-shadow" style="background-color: {{item}}; margin-top: {{index > 4 ? '32rpx' : 0}}" bindtap="checkCorlor" data-color="{{item}}"></view>
  52. <image bindtap="addColor" class="activeColor" src="../../images/img/increase.png" mode="widthFix" style="margin-top: {{activeColorList.length > 4 ? '32rpx' : 0}}"/>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <wxs src = "../../utils/tools.wxs" module="tools"></wxs>
  1. /* treatmentPages/drawingCanvas/drawingCanvas.wxss */
  2. .viewPadd {
  3. background-color: #fff;
  4. padding: 0 30rpx;
  5. border-radius: 14rpx;
  6. margin-top: 46rpx;
  7. box-shadow: 0 0 4rpx 6rpx #ededed;
  8. }
  9. .viewHeader {
  10. height: 94rpx;
  11. line-height: 94rpx;
  12. border-bottom: 1rpx solid #DCDCDC;
  13. position: relative;
  14. font-size: 32rpx;
  15. font-weight: bold;
  16. color: #53545F;
  17. padding-left: 48rpx;
  18. }
  19. .viewHeader::before {
  20. content: '';
  21. position: absolute;
  22. top: 50%;
  23. left: 15rpx;
  24. transform: translateY(-50%);
  25. background-color: #007AFF;
  26. width: 10rpx;
  27. height: 30rpx;
  28. border-radius: 5rpx;
  29. border: none;
  30. display: block;
  31. }
  32. .viewContent {
  33. padding: 44rpx 20rpx 100rpx;
  34. color: #666666;
  35. font-size: 30rpx;
  36. line-height: 48rpx;
  37. }
  38. .btnBox {
  39. height: 80rpx;
  40. }
  41. .btn {
  42. background-color: #007AFF;
  43. border-radius: 14rpx;
  44. color: #fff;
  45. font-size: 32rpx;
  46. border: none;
  47. }
  48. .canvasBox {
  49. width: 100%;
  50. height: calc(100vh - 520rpx);
  51. background-color: #fff;
  52. border-radius: 14rpx;
  53. }
  54. .canvasToll {
  55. width: 100%;
  56. background-color: #fff;
  57. height: 124rpx;
  58. border-radius: 14rpx;
  59. margin: 46rpx 0;
  60. display: flex;
  61. justify-content: space-around;
  62. align-items: center;
  63. }
  64. .canvasToll image {
  65. height: 52rpx;
  66. }
  67. .bottomBox {
  68. position: fixed;
  69. bottom: 50rpx;
  70. left: 30rpx;
  71. right: 30rpx;
  72. z-index: 2;
  73. }
  74. .countdownBox {
  75. background-color: #fff;
  76. position: fixed;
  77. right: 0;
  78. top: 400rpx;
  79. border-radius: 30rpx 0 0 30rpx;
  80. display: flex;
  81. justify-content: center;
  82. align-items: center;
  83. width: 176rpx;
  84. height: 60rpx;
  85. color: #666666;
  86. font-size: 24rpx;
  87. box-shadow: -2rpx 0 16rpx 10rpx rgba(144, 138, 131, 0.35);
  88. }
  89. .countdownBox image {
  90. height: 35rpx;
  91. margin-right: 14rpx;
  92. }
  93. .textInput {
  94. position: fixed;
  95. bottom: 50rpx;
  96. left: 30rpx;
  97. right: 30rpx;
  98. height: 80rpx;
  99. z-index: 10;
  100. /* border: none; */
  101. }
  102. .textFormat {
  103. background-color: #fff;
  104. position: fixed;
  105. bottom: 200rpx;
  106. left: 0;
  107. border-radius: 0 30rpx 30rpx 0;
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. width: 100rpx;
  112. height: 60rpx;
  113. color: #666666;
  114. font-size: 24rpx;
  115. box-shadow: -2rpx 0 16rpx 10rpx rgba(144, 138, 131, 0.35);
  116. z-index: 3;
  117. }
  118. .maskBackground {
  119. background-color: rgba(144, 138, 131, 0.1);
  120. }
  121. .pickerBox {
  122. position: absolute;
  123. width: 100%;
  124. bottom: 0;
  125. left: 0;
  126. box-sizing: border-box;
  127. z-index: 9;
  128. border-radius: 34rpx 34rpx 0 0;
  129. overflow: hidden;
  130. box-shadow: 0rpx 0rpx 4rpx 10rpx #14010128;
  131. max-height: 80%;
  132. overflow-y: auto;
  133. }
  134. .maskTitle {
  135. line-height: 120rpx;
  136. font-weight: bold;
  137. font-size: 40rpx;
  138. padding: 0 30rpx;
  139. display: flex;
  140. align-items: center;
  141. justify-content: space-between;
  142. color: #000000;
  143. }
  144. .guanImg {
  145. width: 51rpx;
  146. }
  147. .formatContent {
  148. display: flex;
  149. align-items: center;
  150. justify-content: space-between;
  151. margin: 50rpx 30rpx 100rpx;
  152. }
  153. .formatContent view {
  154. width: 168rpx;
  155. height: 114rpx;
  156. line-height: 114rpx;
  157. text-align: center;
  158. background-color: #F1F1F6;
  159. font-weight: bold;
  160. }
  161. .formatContent view:nth-child(1) {
  162. border-radius: 20rpx 0 0 20rpx;
  163. }
  164. .formatContent view:nth-child(3) {
  165. text-decoration: underline;
  166. }
  167. .formatContent view:nth-child(4) {
  168. border-radius: 0 20rpx 20rpx 0;
  169. text-decoration: line-through;
  170. }
  171. .brushDialog {
  172. background-color: #fff;
  173. width: 442rpx;
  174. border-radius: 20rpx;
  175. position: absolute;
  176. right: -10rpx;
  177. top: -180rpx;
  178. box-shadow: 2rpx 4rpx 8rpx 6rpx rgba(122, 122, 122, 0.40);
  179. z-index: 3;
  180. }
  181. .brushWidthBox {
  182. display: flex;
  183. justify-content: space-around;
  184. padding: 28rpx 0;
  185. border-bottom: 1rpx solid #C6C6C7;
  186. }
  187. .brushWidthBox image {
  188. height: 46rpx;
  189. }
  190. .globalAlphaBox {
  191. width: 100%;
  192. margin: 0;
  193. }
  194. .brushDialog::after {
  195. content: "";
  196. position: absolute;
  197. bottom: -0rpx;
  198. right: 85rpx;
  199. width: 60rpx;
  200. height: 30rpx;
  201. background-color: #fff;
  202. }
  203. .brushDialog::before {
  204. content: "";
  205. position: absolute;
  206. bottom: -20rpx;
  207. right: 96rpx;
  208. box-shadow: 2rpx 4rpx 8rpx 6rpx rgba(122, 122, 122, 0.40);
  209. border-radius: 6rpx;
  210. width: 40rpx;
  211. height: 40rpx;
  212. background: #fff;
  213. transform: rotate(45deg);
  214. }
  215. .globalAlphaBox .wx-slider-handle-wrapper {
  216. height: 40rpx;
  217. border-radius: 40rpx !important;
  218. }
  219. .globalAlphaBoxInColor {
  220. width: 510rpx;
  221. margin: 0;
  222. }
  223. .globalAlphaBoxInColor .wx-slider-handle-wrapper {
  224. height: 70rpx;
  225. border-radius: 70rpx !important;
  226. }
  227. .sliderBg {
  228. margin: 20rpx 0rpx;
  229. position: relative;
  230. }
  231. .setBgOpacity {
  232. position: absolute;
  233. top: 20rpx;
  234. left: 0;
  235. bottom: 20rpx;
  236. width: 100%;
  237. border-radius: 40rpx;
  238. }
  239. .sliderBox {
  240. display: flex;
  241. align-items: center;
  242. justify-content: space-between;
  243. padding: 0 30rpx;
  244. box-sizing: border-box;
  245. }
  246. .opticyLabel {
  247. padding: 70rpx 30rpx 0;
  248. color: #666666;
  249. font-size: 24rpx;
  250. }
  251. .slideValue {
  252. width: 144rpx;
  253. height: 70rpx;
  254. line-height: 70rpx;
  255. text-align: center;
  256. background-color: #fff;
  257. border-radius: 13rpx;
  258. color: #666666;
  259. font-size: 32rpx;
  260. }
  261. .colorBottomBox {
  262. margin: 20rpx 30rpx 80rpx;
  263. padding: 46rpx 30rpx 46rpx 0;
  264. border-top: 1rpx solid #C6C6C7;
  265. display: flex;
  266. justify-content: space-between;
  267. }
  268. .activeColorBox {
  269. width: 146rpx;
  270. height: 146rpx;
  271. border-radius: 16rpx;
  272. }
  273. .activeColorArr {
  274. width: 470rpx;
  275. height: 146rpx;
  276. display: flex;
  277. flex-wrap: wrap;
  278. }
  279. .activeColor {
  280. width: 60rpx;
  281. height: 60rpx;
  282. border-radius: 50%;
  283. margin-left: 34rpx;
  284. }
  285. .colorContent {
  286. height: calc(100% - 120rpx);
  287. overflow-y: scroll;
  288. }
  1. {
  2. "usingComponents": {
  3. "color-picker":"../components/mini-color-picker/color-picker"
  4. }
  5. }
  1. var app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. navBarHeight: app.globalData.navBarHeight,
  8. navBarObj: {
  9. bgColor: '#fff',
  10. showBackBtn: true,
  11. showHomeBtn: true,
  12. title: '心理绘画'
  13. },
  14. appraisalPlanid: null, //患者疗愈计划id
  15. id: null, //疗愈具体数据的id
  16. x: 0, //开始的位置
  17. y: 0,
  18. newx: 0, //移动的位置
  19. newy: 0,
  20. timerValue: {
  21. text: '00:00:00', //显示的时间
  22. seconds: 0 //秒数
  23. },
  24. timer: null, //计时器
  25. canvasType: 1, // 1 线 2 文本
  26. inputValue: '', //文本内容
  27. hiddenFormat: true,
  28. focus: false,
  29. showDialog: false, //底部的弹窗 1 颜色 2 文本格式
  30. formatList: ['B', '/', 'U', 'S'],
  31. textFormat: null, //选中的文本格式
  32. brushList: [
  33. {url: 'brushLine1.png', value: 1},
  34. {url: 'brushLine2.png', value: 5},
  35. {url: 'brushLine3.png', value: 10},
  36. {url: 'brushLine4.png', value: 15},
  37. {url: 'brushLine5.png', value: 20}
  38. ],
  39. lineWidth: 1, //线的宽度
  40. globalAlpha: '1', //笔的透明度 范围 0-1
  41. brushDialogHidden: true,
  42. activeColorList: [],
  43. strokeStyle: 'rgb(0,0,0)',//线的颜色 初始值
  44. pick: true
  45. },
  46. /**
  47. * 生命周期函数--监听页面加载
  48. */
  49. onLoad(options) {
  50. this.setData({
  51. appraisalPlanid: options.appraisalplanid,
  52. id: options.id
  53. })
  54. this._canvasInit();
  55. this.getDrawingColor()
  56. },
  57. getDrawingColor() {
  58. wx.request({
  59. url: app.globalData.serverAddress + '/hcHealRemind/getUserDrawingColor',
  60. method: 'GET',
  61. data: {
  62. userId: app.globalData.userid
  63. },
  64. success: (res) => {
  65. if(res.data.code !== 0) {
  66. return wx.showToast({
  67. title: res.data.msg || '获取用户画板颜色数据失败',
  68. icon: 'none'
  69. })
  70. }
  71. this.setData({
  72. activeColorList: res.data.data
  73. })
  74. }
  75. })
  76. },
  77. _starTimer() {
  78. let that = this;
  79. if(that.data.timer) return
  80. let setSeconds = `timerValue.seconds`
  81. let textTime = `timerValue.text`
  82. that.data.timer = setInterval(() => {
  83. let seconds = that.data.timerValue.seconds + 1;
  84. that.setData({
  85. [setSeconds]: seconds,
  86. [textTime]: that._getTimeBySecond(seconds)
  87. })
  88. }, 1000);
  89. },
  90. _endTimer() {
  91. const that = this;
  92. if(that.data.timer) {
  93. clearInterval(that.data.timer)
  94. }
  95. },
  96. // 秒转时间
  97. _getTimeBySecond(seconds) {
  98. let hour = Math.floor(seconds / 3600);
  99. let minute = Math.floor(seconds % 3600 / 60);
  100. let second = seconds % 3600 % 60
  101. hour < 10 ? hour = '0' + hour : '';
  102. minute < 10 ? minute = '0' + minute : '';
  103. second < 10 ? second = '0' + second : '';
  104. return hour + ":" + minute + ":" + second
  105. },
  106. _canvasInit() {
  107. var ctx = wx.createCanvasContext('myCanvas');
  108. ctx.setFontSize(16) //设置字体的字号
  109. this.ctx = ctx
  110. },
  111. //触摸开始
  112. start(e) {
  113. this._starTimer(10);
  114. let startx = e.changedTouches[0].x;
  115. let starty = e.changedTouches[0].y;
  116. this.setData({
  117. x: startx,
  118. y: starty
  119. })
  120. this.hideBrushDialog();
  121. if(this.data.canvasType == 2) { //文本
  122. this.setData({
  123. hiddenFormat: false,
  124. focus: true
  125. })
  126. }
  127. },
  128. //触摸移动
  129. move(e) {
  130. if(this.data.canvasType == 2) { //文本
  131. return
  132. }
  133. let movex = e.changedTouches[0].x;
  134. let movey = e.changedTouches[0].y;
  135. this.setData({
  136. newx: movex,
  137. newy: movey
  138. })
  139. this._drawingLine(this.data.x, this.data.y, this.data.newx, this.data.newy)
  140. this.setData({
  141. x: movex,
  142. y: movey
  143. })
  144. },
  145. // 画线方法
  146. _drawingLine(startx, starty, movex, movey) {
  147. // 设置线
  148. if(this.data.canvasType == 2) { //文本里面的线
  149. this.ctx.setLineWidth(1)
  150. this.ctx.strokeStyle = "rgb(0,0,0)"
  151. this.ctx.setGlobalAlpha(1)
  152. } else {
  153. this.ctx.setLineWidth(this.data.lineWidth)
  154. this.ctx.strokeStyle = this.data.strokeStyle
  155. this.ctx.setGlobalAlpha(this.data.globalAlpha)
  156. }
  157. this.ctx.beginPath() //开始定义路径
  158. this.ctx.moveTo(startx, starty) //起始点
  159. this.ctx.lineTo(movex, movey) //连接到的坐标点
  160. this.ctx.stroke() //沿着绘制的坐标点路径绘制直线
  161. this.ctx.draw(true) //将之前在绘图上下文中画到 canvas 中
  162. },
  163. //绘制文本
  164. _drawingText() {
  165. let textFormat = this.data.textFormat;
  166. this.ctx.font = "normal 16px Arial"
  167. if(textFormat == 'B') {
  168. this.ctx.font = "bold 16px Arial" //加粗
  169. } else if(textFormat == '/') {
  170. this.ctx.font = "italic 16px Arial" //倾斜
  171. } else if(textFormat == 'U') { //下划线
  172. let textWidth = this.ctx.measureText(this.data.inputValue).width;
  173. this._drawingLine(this.data.x, this.data.y + 5, this.data.x + textWidth, this.data.y + 5)
  174. } else if(textFormat == 'S') { //删除线
  175. let textWidth = this.ctx.measureText(this.data.inputValue).width;
  176. this._drawingLine(this.data.x, this.data.y - 5, this.data.x + textWidth, this.data.y - 5)
  177. }
  178. // this.ctx.setFillStyle('blue') //设置填充色
  179. this.ctx.fillText(this.data.inputValue, this.data.x, this.data.y) //在画布上输出的文本 内容 x y
  180. this.ctx.draw(true)
  181. },
  182. //点击文本
  183. chengeText() {
  184. this.setData({
  185. canvasType: 2,
  186. textFormat: null
  187. })
  188. },
  189. //输入框
  190. bindKeyInput(e) {
  191. this.setData({
  192. inputValue: e.detail.value
  193. })
  194. },
  195. //输入框点击完成按钮
  196. confirmInput(e) {
  197. this._drawingText()
  198. this.setData({
  199. canvasType: 1,
  200. hiddenFormat: true,
  201. focus: false,
  202. inputValue: ''
  203. })
  204. },
  205. //点击格式
  206. openFormat() {
  207. this.setData({
  208. showDialog: 2
  209. })
  210. },
  211. //选中绘本文字的格式
  212. changeFormat(e) {
  213. this.setData({
  214. textFormat: e.currentTarget.dataset.value
  215. })
  216. this.hideMask()
  217. },
  218. preventevents() {},
  219. hideMask() {
  220. if(this.data.showDialog == 1) {
  221. this.addColor()
  222. }
  223. this.setData({
  224. showDialog: false
  225. })
  226. if(this.data.canvasType == 2) {
  227. this.setData({
  228. focus: true
  229. })
  230. }
  231. },
  232. //打开画笔弹窗
  233. openBrushDialog() {
  234. this.setData({
  235. brushDialogHidden: !this.data.brushDialogHidden,
  236. hiddenFormat: true
  237. })
  238. },
  239. //关闭画笔的弹窗
  240. hideBrushDialog() {
  241. if(!this.data.brushDialogHidden) {
  242. this.setData({
  243. brushDialogHidden: true
  244. })
  245. }
  246. },
  247. //点击底部区域
  248. closeDialog() {
  249. this.hideBrushDialog();
  250. this.setData({
  251. hiddenFormat: true
  252. })
  253. },
  254. //选择画笔
  255. checkBrush(e) {
  256. this.setData({
  257. lineWidth: e.currentTarget.dataset.value
  258. })
  259. },
  260. // 画笔透明度
  261. sliderchange(e) {
  262. this.setData({
  263. globalAlpha: e.detail.value
  264. })
  265. },
  266. //打开颜色对话框
  267. openColorDialog() {
  268. this.setData({
  269. showDialog: 1
  270. })
  271. },
  272. //取色结果回调
  273. pickColor(e) {
  274. let rgb = e.detail.color;
  275. this.setData({
  276. strokeStyle: rgb
  277. })
  278. },
  279. checkCorlor(e) {
  280. this.setData({
  281. strokeStyle: e.currentTarget.dataset.color,
  282. showDialog: false
  283. })
  284. },
  285. // 保存用户画板颜色
  286. addColor() {
  287. wx.request({
  288. url: app.globalData.serverAddress + '/hcHealRemind/insertUserDrawingColor',
  289. method: 'POST',
  290. data: {
  291. userId: app.globalData.userid,
  292. drawingColor: this.data.strokeStyle
  293. },
  294. success: (res) => {
  295. if(res.data.code !== 0) {
  296. return wx.showToast({
  297. title: res.data.msg || '保存用户画板颜色失败',
  298. icon: 'none'
  299. })
  300. }
  301. this.setData({
  302. activeColorList: res.data.data
  303. })
  304. }
  305. })
  306. },
  307. submit() {
  308. let that = this;
  309. that._endTimer();
  310. wx.showLoading({
  311. title: '图片生成中...',
  312. })
  313. wx.canvasToTempFilePath({
  314. x: 0,
  315. y: 0,
  316. canvasId: 'myCanvas',
  317. success(res) {
  318. wx.uploadFile({
  319. url: app.globalData.serverAddress + '/hcHealRemind/finishPsychologyDrawing',
  320. filePath: res.tempFilePath,
  321. name: 'file',
  322. formData: {
  323. appraisalPlanid: that.data.appraisalPlanid,
  324. remindId: that.data.id,
  325. workingHours: that.data.timerValue.seconds
  326. },
  327. success (res){
  328. wx.switchTab({
  329. url: '/pages/healing/index',
  330. })
  331. },
  332. complete() {
  333. wx.hideLoading()
  334. }
  335. })
  336. }
  337. })
  338. },
  339. /**
  340. * 生命周期函数--监听页面初次渲染完成
  341. */
  342. onReady() {
  343. },
  344. /**
  345. * 生命周期函数--监听页面显示
  346. */
  347. onShow() {
  348. },
  349. /**
  350. * 生命周期函数--监听页面隐藏
  351. */
  352. onHide() {
  353. },
  354. /**
  355. * 生命周期函数--监听页面卸载
  356. */
  357. onUnload() {
  358. this._endTimer();
  359. },
  360. /**
  361. * 页面相关事件处理函数--监听用户下拉动作
  362. */
  363. onPullDownRefresh() {
  364. },
  365. /**
  366. * 页面上拉触底事件的处理函数
  367. */
  368. onReachBottom() {
  369. },
  370. /**
  371. * 用户点击右上角分享
  372. */
  373. onShareAppMessage() {
  374. }
  375. })

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/955089
推荐阅读
相关标签
  

闽ICP备14008679号