成功保存数据时,在Vue中显示的成功消息
<p><pre class="brush:php;toolbar:false;">axios
.post(
"/api/product/store",{
id: this.id
})
.then((res) => {
var variant = "danger";
var icon = "XIcon";
var message = "Thất bại";
if (res.data.error == 0) {
var variant = "success";
var icon = "ArrowDownCircleIcon";
var message = res.data.message;
window.location.reload();
}
this.$toast({
component: ToastificationContent,
props: {
title: message,
icon: icon,
variant: variant,
},
});
})
.catch((error) => {
});</pre>
<p>我的问题是:当消息显示时,它只会加载页面,因此当页面重新加载时,它会丢失消息。有没有办法重新加载上一页,然后显示以下消息?谢谢。</p>