const {ccclass, property} = cc._decorator; export interface ICardData { price: number name: string portrait: string } @ccclass export default class Card extends cc.Component { @property({type: cc.Sprite}) mainImg: cc.Sprite = null @property({type: cc.Sprite}) nameImg: cc.Sprite = null @property({type: cc.Label}) priceLabel: cc.Label = null start () { } init(data: ICardData) { console.log('card init with data: ', data) } }