【发布时间】:2018-10-10 21:06:02
【问题描述】:
我不知道这是否只是文档中缺少某些内容的问题,还是我误解了 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 会产生相同的结果
【问题讨论】:
-
你有错误吗?
标签: javascript vue.js vuejs2 modal-dialog