Javascript vue js模式对话框未关闭
我不知道这是因为文档中缺少了什么,还是因为我误解了Javascript vue js模式对话框未关闭,javascript,vue.js,vuejs2,modal-dialog,Javascript,Vue.js,Vuejs2,Modal Dialog,我不知道这是因为文档中缺少了什么,还是因为我误解了vue js modal包的工作原理。 我似乎无法关闭对话框模态 示例和屏幕截图: 我已创建此模式对话框: delete_entry_modal(item) { this.$modal.show('dialog', { title: 'Delete entry?', text: `Are you sure that you want to delete the ${item.listing_type} en
vue js modal
包的工作原理。
我似乎无法关闭对话框模态
示例和屏幕截图:
我已创建此模式对话框:
delete_entry_modal(item) {
this.$modal.show('dialog', {
title: 'Delete entry?',
text: `Are you sure that you want to delete the ${item.listing_type} entry from ${item.from_address} to ${item.to_address }@${item.to_domain}?`,
buttons: [
{
title: 'Yes',
handler: () => {
this.setLoading(true);
axios.delete('/api/lists/'+item.id+'/').then(response => {
this.setLoading(false);
this.notify(this.createNotification('Entry deleted', `The ${item.listing_type} entry from ${item.from_address} to ${item.to_address }@${item.to_domain} has been deleted`, 'success'));
}).catch(error => {
this.setLoading(false);
this.notify(this.createNotification('An error occurred', `${error}`, 'error'));
});
this.$emit('close');
},
default: true
},
{
title: 'No'
}
]
})
}
我以以下方式加载VModal:
Vue.use(VModal, { dialog: true, dynamic: true, injectModalsContainer: true });
当我点击“否”按钮时,模式关闭。如果单击“是”,它将运行处理程序代码,但不会关闭模式。按键盘上的
Enter
可产生相同的结果$emit
通过向父级广播在模板范围内工作。因为您没有使用模板,所以需要通过附加到VueConstructor
this.$modal.hide('dialog')
你有错误吗?