mint-ui 的messagebox 点击完成后,怎么跳转路由?

新手上路,请多包涵
                        if (response.data.success) {
                            this.CLEAR_ALL_SETTLE()
                            MessageBox({
                                title: '支付成功',
                                message: '您的订单会尽快给您处理',
                                confirmButtonText: '完成'
                            }).alert().then(action => {
                                 this.$router.push({ path: '/center/mycenter'});
                                 //这里路由跳转没生效啊
                            });
                            
                        } else {
                            MessageBox({
                                title: '支付失败',
                                message: '支付遇到问题,请尝试重新支付',
                                showCancelButton: true,
                                confirmButtonText: '重新支付'
                            }).confirm().then(action => {

                            });

                        }
阅读 5.6k
3 个回答

试试这样呢?

 if (response.data.success) {
    this.CLEAR_ALL_SETTLE()
    MessageBox({
        title: '支付成功',
        message: '您的订单会尽快给您处理',
        confirmButtonText: '完成'
    }).then(action => {
    if (action == 'confirm'){
         this.$router.push({ path: '/center/mycenter'});
         //这里路由跳转没生效啊
         }
    });
    
} 
新手上路,请多包涵
                 if (response.data.success) {
                        this.CLEAR_ALL_SETTLE()
                        MessageBox({
                            title: '支付成功',
                            message: '您的订单会尽快给您处理',
                            confirmButtonText: '完成'
                        }).then(action => {
                             this.$router.push({ path: '/center/mycenter'});
                             //给alert()去掉就好了
                        });
                        
                    } else {
                        MessageBox({
                            title: '支付失败',
                            message: '支付遇到问题,请尝试重新支付',
                            showCancelButton: true,
                            confirmButtonText: '重新支付'
                        }).then(action => {

                        });

                    }
                    
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题