直接上代码
let times = 3
const msgIns = this.$message({
type: 'warning',
message: `请登录后再进行该操作,${times}s 后跳转到登录页`,
duration: 0,
showClose: true
})
const timer = setInterval(() => {
times--
msgIns.message = `请登录后再进行该操作,${times}s 后跳转到登录页`
if (times === 0) {
clearInterval(timer)
setTimeout(() => {
msgIns.close()
this.$router.push({ path: '/login' });
}, 1000)
}
}, 1000)