level-render/assets/demo/Item.ts

19 lines
333 B
TypeScript
Raw Normal View History

2024-01-19 03:35:46 +00:00
import { Label } from 'cc';
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
export interface IItem {
id: number
}
@ccclass('Item')
export class Item extends Component {
@property(Label)
lbl: Label = null;
setData(p: IItem) {
this.lbl.string = `${p.id}`
}
}