B模态有可能要等到B模态关闭后再继续执行方法?

时间:2019-07-12 07:48:20

标签: javascript vue.js

嗨,我需要以下代码示例的帮助。 当我渲染b模态时,我必须等到客户从中选择一些选项,并且此选项的基础需要填充newItem对象。 第二种选择是客户不保存他的选择,而只是关闭b模态,在这种情况下,我必须结束这种方法。请怎么做?

addTransportItem(event) {

    this.renderTransportModal=true;
    this.$nextTick(()=> {
        this.$root.$emit('bv::show::modal', 'modal-transport-choose');
    }
    );

    //I NEED CONTINUE AFTER MODAL IS CLOSED OR CLICKED SAVE BUTTON IN MODAL
    //Now code just continue after modal was open

    let newItem= {
        agreed_amount: 0, 
        created_at: moment(new Date()).format(('YYYY-MM-DD,h:mm:ss')),
        invoice_id: null, name: null, 
        total_price: 0, 
        unit_price: 0, 
        updated_at: null, 
        _rowVariant: "warning"
    }

    newItem.updated_at=newItem.created_at;
    this.gridTransportItems.push(newItem);
}

0 个答案:

没有答案