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

@ccclass('edit_event_more_item')
export class edit_event_more_item extends Component {
    @property(Node) lab_id:Node = null;
    @property(Node) lab_remark:Node = null;
    @property(Node) img_delete:Node = null;
    private m_delete_callback: Function = null;
    start() {
        this.img_delete.on(Node.EventType.TOUCH_END, ()=>{
            if(this.m_delete_callback!=null) {
                tools.show_dialog('删除?', ()=>{
                    this.m_delete_callback()
                })
            }
        },this)
    }

    initView(data:event_widget_more_event_item, delete_callback:Function) {
        this.m_delete_callback = delete_callback
        this.lab_id.getComponent(Label).string = 'id:' + data.binding_widget_id
        this.lab_remark.getComponent(Label).string = data.binding_widget_remark
    }
}

