const { ccclass, property } = cc._decorator; @ccclass export default class TurnableItem extends cc.Component { @property(cc.Sprite) icon: cc.Sprite = null; @property(cc.Label) lbl_name: cc.Label = null; public async initData(type) { this.icon.spriteFrame = await mk.loader.load('module/turnable/texture/hb' + type, cc.SpriteFrame); this.lbl_name.string = type == 1 ? "少量红包" : type == 2 ? "中量红包" : "大量红包"; } }