目录
1. 普通跳转
setTimeout(function () {
//实现方法
}, 1500);
2. 跳转路由
在里面,不能直接写this.$router/push("/") ,会报错,
解决方法:先在外层定义,let that=this;然后在里面使用that
async SaveData(param) {
let that = this;
let resultdatas = {
code: 200,
msg: "保存成功,即将跳转到首页",
};
if (resultdatas.code === 200) {
Message.success({
message: resultdatas.msg,
});
//过几秒执行
setTimeout(function () {
that.$router.push("/mainIndex");
}, 1500);
} else {
Notification.error({
title: "提示",
message: resultdatas.msg,
offset: 50,
});
}