10秒后去某个页面的方法

data () {
  return {
    
    timer: null

  }
}
tenGo () {
const TIME_COUNT = 10 if (!this.timer) { this.countTime = TIME_COUNT this.timer = setInterval(() => { if (this.countTime > 0 && this.countTime <= TIME_COUNT) { this.countTime -- } else { clearInterval(this.timer) this.timer = null this.$router.push({ path: '/bkShop/myExchange' }) } }, 1000) } },

猜你喜欢

转载自www.cnblogs.com/taochengyong/p/10873499.html