element ui 自动关闭弹框

1.弹框

this.$alert('企业解散成功,您即将退出系统!<br/>', '', {
    showClose:false,
    showCancelButton:false,
    showConfirmButton:false,
    closeOnPressEscape:false,
    closeOnHashChange:false,
    center:true,
    type:'warning',
    dangerouslyUseHTMLString: true
});

2.利用javascript删除弹框

this.autoTimer = setInterval(()=>{
    if(time === 1){
        clearInterval(this.autoTimer);
        removeSessionStore(SESSION_ID);
        let messageBox = document.getElementsByClassName("el-message-box__wrapper");
        let model = document.getElementsByClassName("v-modal");
        if(messageBox){
            messageBox[0].parentNode.removeChild(messageBox[0]);
            model[0].parentNode.removeChild(model[0]);
        }
        this.$router.push({ name: "login" });
    }
    time--;
},1000);
发布了72 篇原创文章 · 获赞 19 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/tyjlearning/article/details/105388144