vue 倒計(jì)時(shí)結(jié)束跳轉(zhuǎn)頁面實(shí)現(xiàn)代碼
vue 倒計(jì)時(shí)結(jié)束跳轉(zhuǎn)頁面
data () { return { timers: null, countDown: null } }
count () { const count = 15 this.countDown = count this.timers = setInterval(() => { if (this.countDown > 0) { this.countDown-- } else { clearInterval(this.timers) this.$router.push('/login') } }, 1000) }
激活條件:this.count()
vue中倒計(jì)時(shí)3秒后跳轉(zhuǎn)頁面
<template> <div id="home"> <div>{{ count }}s后將自動(dòng)跳轉(zhuǎn)到登錄頁!</div> </div> </template> <script> export default { data(){ return { count:"",//倒計(jì)時(shí) } } }, created(){ ??????this.threeGo() }, methods: { //3秒后進(jìn)入跳轉(zhuǎn)頁面 threeGo(){ const TIME_COUNT = 3; if(!this.timer){ this.count = TIME_COUNT; this.show = false; this.timer = setInterval(()=>{ if(this.count > 0 && this.count <= TIME_COUNT){ this.count--; }else{ this.show = true; clearInterval(this.timer); this.timer = null; //跳轉(zhuǎn)的頁面寫在此處 this.$router.push({ path: '' }); } },1000) } }, } </script>
到此這篇關(guān)于vue 倒計(jì)時(shí)結(jié)束跳轉(zhuǎn)頁面的文章就介紹到這了,更多相關(guān)vue 倒計(jì)時(shí)跳轉(zhuǎn)頁面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- vue如何跳轉(zhuǎn)到其他頁面
- vue跳轉(zhuǎn)頁面的幾種常用方法代碼示例
- vue 跳轉(zhuǎn)到其他頁面并關(guān)閉當(dāng)前頁面的實(shí)現(xiàn)代碼
- vue實(shí)現(xiàn)頁面跳轉(zhuǎn)和參數(shù)傳遞的兩種方式
- Vue路由跳轉(zhuǎn)傳參或打開新頁面跳轉(zhuǎn)的方法總結(jié)
- vue路由跳轉(zhuǎn)到新頁面實(shí)現(xiàn)置頂
- vue實(shí)現(xiàn)三級(jí)頁面跳轉(zhuǎn)功能
- vue3頁面跳轉(zhuǎn)的兩種方式
- vue3 setup點(diǎn)擊跳轉(zhuǎn)頁面的實(shí)現(xiàn)示例
相關(guān)文章
jdk1.8+vue elementui實(shí)現(xiàn)多級(jí)菜單功能
這篇文章主要介紹了jdk1.8+vue elementui實(shí)現(xiàn)多級(jí)菜單功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-09-09Vue.js移動(dòng)端左滑刪除組件的實(shí)現(xiàn)代碼
本篇文章主要介紹了Vue.js移動(dòng)端左滑刪除組件的實(shí)現(xiàn)代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09vue router解決路由帶參數(shù)跳轉(zhuǎn)時(shí)出現(xiàn)404問題
我的頁面是從一個(gè)vue頁面router跳轉(zhuǎn)到另一個(gè)vue頁面,并且利用windows.open() 瀏覽器重新創(chuàng)建一個(gè)頁簽,但是不知道為什么有時(shí)候可以有時(shí)候又不行,所以本文給大家介紹了vue router解決路由帶參數(shù)跳轉(zhuǎn)時(shí)出現(xiàn)404問題,需要的朋友可以參考下2024-03-03Vue3-新特性defineOptions和defineModel示例詳解
在Vue3.3中新引入了defineOptions宏主要是用來定義Option API的選項(xiàng),可以用defineOptions定義任意的選項(xiàng),props、emits、expose、slots除外,本文給大家介紹Vue3-新特性defineOptions和defineModel,感興趣的朋友一起看看吧2023-11-11詳解從零搭建 vue2 vue-router2 webpack3 工程
本篇文章主要介紹了詳解從零搭建 vue2 vue-router2 webpack3 工程,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-11-11vue3配置permission.js和router、pinia實(shí)現(xiàn)路由攔截的簡(jiǎn)單步驟
這篇文章主要介紹了如何在場(chǎng)景網(wǎng)站中實(shí)現(xiàn)對(duì)未登錄用戶訪問的攔截,通過配置Pinia,創(chuàng)建一個(gè)user.js文件來存儲(chǔ)用戶數(shù)據(jù),并在main.js中進(jìn)行配置,同時(shí)通過在router目錄下創(chuàng)建permission.js文件,可以實(shí)現(xiàn)對(duì)未登錄用戶的攔截,需要的朋友可以參考下2024-11-11