vue 警示框执行不了

delData() {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
debugger;
console.log(vm_data.form.Sid);
var ss = "33";
var d = {
id: vm_data.form.Sid
};
var jsondata = JSON.stringify(d);
$.ajax({
url: "/QPAE/Delete",
type: "post",
data: jsondata,
contentType: "application/json",
dataType: "json",
success: function (e) {
if (e.flag) {
this.$message({
type: 'success',
message: '删除成功!'});
window.location.href = "@Url.Action("Index")";
}
}
});
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}

红色标注的代码加上去后,就不执行了, 统统都是 已取消删除,不知道是那里错了,哎

回答

在外面 const _this = this,然后在里面是有 _this.$message...

以上是vue 警示框执行不了的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>