Before beforeEach mounts the instance again, router.js is invalid and cannot be redirected to other pages.

import Vue from "vue"
import App from "./App"
import router from "./router/router"

Vue.config.productionTip = false
// import { queryList } from "./api/index"
import util from "./util/util"
router.beforeEach((to, from, next) => {
  let code = util.getCode("code")
  alert(code)
  if (!code) {
    // util.weixinauth()
    console.log(1111)
  } else {
    // queryList({ code: code }).then(res => {
    //   console.log(res, 36)
    //   alert(res.data.openid + "" + res.data.nickname)
    // })
    console.log(2222)

    next()
  }
})

/* eslint-disable no-new */
new Vue({
  el: "-sharpapp",
  router,
  components: { App },
  template: "<App/>"
})

Mar.17,2022

router.beforeEach((to, from, next) => {
  let code = util.getCode('code')
  alert(code)
  if (!code) {
    // util.weixinauth()
    console.log(1111)
  } else {
    // queryList({ code: code }).then(res => {
    //   console.log(res, 36)
    //   alert(res.data.openid + '' + res.data.nickname)
    // })
    console.log(2222)
  }


  next()
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c13f-2c2da.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c13f-2c2da.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?