Vue自動跳轉另一個界面


<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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM