页面跳转问题:如果页面跳转非常迅速,可能在弹框还未完全渲染之前页面就已经跳转了,导致用户看不到弹框。可以尝试在跳转前加入一个短暂的延迟,例如:
f(resp.data==='success'){
//弹出成功信息框
that.$message({
message: '添加成功',
type: 'success'
});
//延时页面跳转,保证信息框成功渲染
setTimeout(() => {
window.location.href = "./index.html";
}, 1000); // 1秒延迟
}
在本页面中:在本页面弹出对话框,数据添加成功关闭对话框可以成功弹出信息框,因为没有涉及到页面跳转问题,直接在本页面中弹出成功信息框。