const { ccclass, property } = cc._decorator; @ccclass export default class DetailPanelItem extends cc.Component { @property(cc.Label) keyLabel: cc.Label = null; @property(cc.Label) valueLabel: cc.Label = null; protected _keyName: string = ''; get keyName(): string { return this._keyName } set keyName(key: string) { this._keyName = key } setItemInfo(key: string, value: string) { this.keyLabel.string = key this.valueLabel.string = value this.keyName = key } updateItemInfo(value: string) { this.valueLabel.string = value } }