MessageEntryItem.ts
1.08 KB
import { MessageEntryItemProps } from "../type/MessageView";
import { DummyLabel, DummyRichText, DummySprite } from "../../../../common/CCDummyObjects";
import { ListItemImpl } from "../../baseview/impl/ListItemImpl";
import { ResUtils } from "../../../../common/utils/ResUtils";
const { ccclass, property } = cc._decorator;
@ccclass
export class MessageEntryItemImpl extends ListItemImpl<MessageEntryItemProps> {
@property({ type: cc.Label })
protected titleLabel: cc.Label = DummyLabel;
@property({ type: cc.RichText })
protected lastMsgLabel: cc.RichText = DummyRichText;
@property(cc.Sprite)
protected iconSprite: cc.Sprite = DummySprite;
onLoad() {
this.bindProp("title", this.titleLabel, "string");
this.bindProp("lastMsg", this.lastMsgLabel, "string");
this.bindProp("redDot", this.node.getChildByName("RedDot"), "active");
this.bindProp("icons", async (value) => {
if (value.length == 1) {
this.iconSprite.spriteFrame = await ResUtils.loadRes(value[0], cc.SpriteFrame);
}
});
}
}