import { _decorator, Component, Label, Node } from 'cc';
import { long_story_list_item_data } from '../../data/data';
const { ccclass, property } = _decorator;

@ccclass('long_story_list_item')
export class long_story_list_item extends Component {
    @property(Node) lab_name:Node = null;
    private m_data:long_story_list_item_data = null;
    private m_call_back = null
    start() {
        this.node.on(Node.EventType.TOUCH_END,()=>{
            if(this.m_call_back) {
                this.m_call_back(this.m_data)
            }
        })
    }

    init(data:long_story_list_item_data, call_back) {
        this.m_data = data;
        this.m_call_back = call_back
        this.lab_name.getComponent(Label).string = data.name;
    }
}

