How to use the @tarojs/taro-h5.PureComponent function in @tarojs/taro-h5

To help you get started, we’ve selected a few @tarojs/taro-h5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-components / src / components / canvas / index.js View on Github external
/**
 * Canvas组件参数
 * @typedef CanvasProps
 * @property {String} [canvasId=canvas] 组件的唯一标识符
 * @property {Boolean} [disableScroll=false] 当在 canvas 中移动时且有绑定手势事件时,禁止屏幕滚动以及下拉刷新
 * @property {EventHandle} onTouchstart 手指触摸动作开始
 * @property {EventHandle} onTouchmove 手指触摸后移动
 * @property {EventHandle} onTouchend 手指触摸动作结束
 * @property {EventHandle} onTouchcancel 手指触摸动作被打断,如来电提醒,弹窗
 * @property {EventHandle} onLongtap 手指长按 500ms 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动
 * @property {EventHandle} onError 当发生错误时触发 error 事件,detail = {errMsg: 'something wrong'}
 */

@touchable()
class Canvas extends Taro.PureComponent {
  /** @type {CanvasProps} */
  static defaultProps = {
    canvasId: '',
    disableScroll: false,
    onError: null
  }

  /** @type {CanvasProps} */
  props
  width = 300
  height = 150
  getWrapRef = ref => {
    if (ref) this.wrapDom = ref
  }
  getCanvasRef = ref => {
    if (ref) this.canvasRef = ref