<template>
<div class = "hello">
<h1>{{msg}}</h1>
<span id ="num">{{count}}</span>秒后跳转到登录界面
</div>
</template>
<script>
export default {
name: "Hello",
data () {
return {
msg:‘欢迎进入教育机构访客系统‘,
count:" "//倒计时
}
},
created() {
this.ClickJump()
},
methods: {
//跳转界面
ClickJump(){
const timejump = 3;
if(!this.timer){
this.count = timejump ;
this.show = false;
this.timer = setInterval(()=>{
if(this.count > 0 && this.count <= timejump ){
this.count--;
}else{
this.show = true;
clearInterval(this.timer);
this.timer = null;
//跳转的页面写在此处
this.$router.push({path: ‘Login‘});
}
},1000)
}
},
}
}
</script>
<style scoped>
</style>
原文:https://www.cnblogs.com/Emma8415/p/14744508.html