【发布时间】:2019-02-03 22:55:15
【问题描述】:
下面是我的代码:
<a
@click="destroy"
:class="['button', { 'is-loading': deleting }]"
>
Delete
</a>
data: () => ({
deleting: false
}),
destroy () {
this.deleting = true
if (!confirm('Sure?') {
this.deleting = false
return
}
}
结果显示一个模态对话框和this.deleting is not true:/
是否可以在对话框之前更改删除属性?
【问题讨论】:
-
你能发一个minimal reproducible example吗?
-
this.deleting is not true是什么意思。当时confirm被调用并且模态显示this.deleting为真。但是,如果您希望 vue 组件执行一些不同的渲染,因为您更改了this.deleting,那么这不会发生,因为confirm正在阻塞。
标签: javascript vue.js