//已TS化,測試無誤可刪除原JS代碼 import GameModel from "../../ts/core/GameModel"; import GameUtil from "../../ts/core/GameUtil"; const {ccclass, property} = cc._decorator; @ccclass export default class ChatAppelItem extends cc.Component { @property(cc.Label) nameLab: cc.Label = null; itemInfo :any =null; onLoad() { } loadInfo(info:any) { this.itemInfo = info; this.itemInfo.type = 5; this.nameLab.string = info.name; } mCallback: any; setCallback(callback) { this.mCallback = callback; } onPetClick() { if(this.mCallback){ this.mCallback(this.itemInfo); } } }