我有一个付款模式,一旦用户填写,它就会打开,如果付款成功,我想重定向到另一个页面,并显示成功消息。我正在使用Laravel 5.3和Vue JS。
现在,它看起来是这样的,我让它重定向到另一个页面,但我如何附加某种成功消息?
this.$http.post('/cropkit/public/subscriptions', this.$data).then(
window.location.replace('/cropkit/public/profile/dashboard'),
response => this.status = response.body.status
);
/********编辑*********/
以下是检查是否成功或发生错误的解决方案:
swal
是一个警报消息插件
this.$http.post('/mysite/subscriptions', this.$data).then((response) => {
swal({
title: "Success!",
text: "Payment has been processed!",
type: "success",
showConfirmButton: false,
allowEscapeKey: false,
allowOutsideClick: false,
timer: 5000,
}),
setTimeout(function(){
window.location.replace('/mysite/profile/dashboard');
}, 4000)
}, (response) => {
this.status = response.body.status
});