JS怎么样页面弹出的消息框消失后再跳转?

                    toastr.success('This Is Success Message', 'Bottom Center', {
                        "positionClass": "toast-bottom-center",
                        timeOut: 5000,
                        "closeButton": true,
                        "debug": false,
                        "newestOnTop": true,
                        "progressBar": true,
                        "preventDuplicates": true,
                        "onclick": null,
                        "showDuration": "300",
                        "hideDuration": "1000",
                        "extendedTimeOut": "1000",
                        "showEasing": "swing",
                        "hideEasing": "linear",
                        "showMethod": "fadeIn",
                        "hideMethod": "fadeOut",
                        "tapToDismiss": false
                    })
                location.href = "/index";

上面这段代码,现在消息框一闪而过,根本看不清消息就已经跳转了。


//简单点处理
setTimeout(()=>{location.href = "/index";},1000)//1s后跳转,1s 够你看吐司内容了吧