UNPKG

bytefun-wxapp

Version:

ByteFun JavaScript SDK

98 lines (97 loc) 2.15 kB
Component({ options: { virtualHost: true, }, /** * 组件的属性列表 */ properties: { comp: { type: Object, default: {}, }, }, /** * 组件的初始数据 */ data: { isClick: true, attr: null, }, lifetimes: { attached() { if (this.data.comp.bindComponent) { this.setData({ attr: this.data.comp.bindComponent(this, 'attr'), }) } }, }, attached() { if (this.data.comp.bindComponent) { this.setData({ attr: this.data.comp.bindComponent(this, 'attr'), }) } }, ready() { if (this.data.attr) { this.data.attr.onReady() } }, /** * 组件的方法列表 */ methods: { handleClick(e) { this.data.attr.onClick && this.data.attr.onClick(e) return true }, handleLongClick(e) { this.data.attr.onLongClick && this.data.attr.onLongClick(e) return false }, handleImageLoad(e) { this.data.attr.imageCallback?.success(e) }, handleImageLoadError(e) { this.data.attr.imageCallback?.failure(e) }, handleTouchStart(e) { this.data.attr.onTouchStart && this.data.attr.onTouchStart(e) }, handleTouchEnd(e) { this.data.attr.onTouchEnd && this.data.attr.onTouchEnd(e) }, handleTouchMove(e) { this.data.attr.onTouchMove && this.data.attr.onTouchMove(e) }, handleTouchCancel(e) { this.data.attr.onTouchCancel && this.data.attr.onTouchCancel(e) }, handleChange(e) { this.data.attr.onChange && this.data.attr.onChange(e) }, handleClose(e) { this.data.attr.onClose && this.data.attr.onClose(e) }, handleFocus(e) { this.data.attr.onFocus && this.data.attr.onFocus(e) }, handleBlur(e) { this.data.attr.onBlur && this.data.attr.onBlur(e) }, handleInput(e) { this.data.attr.onInput && this.data.attr.onInput(e) }, handleScroll(e) { this.data.attr.onScroll && this.data.attr.onScroll(e) }, handleGetUserInfo(e) { // 获取用户信息 }, stopTouchMove() { return false }, }, })