Files
SuperScrollView_2.X/assets/scripts/baseItem.ts

25 lines
576 B
TypeScript
Raw Permalink Normal View History

2022-01-13 09:27:08 +08:00
const { ccclass, property } = cc._decorator;
@ccclass
export default class BaseItem extends cc.Component {
@property(cc.Label) label: cc.Label = null
@property(cc.EditBox) input: cc.EditBox = null
private index: number
private clickFunc: Function
get transform() {
return this.node
}
show(data: any, index: number, callback: Function) {
this.index = index
this.label.string = data.message
this.clickFunc = callback
}
onClick() {
this.clickFunc.call(this, this.index)
}
onInput() {
}
}