How to use the routed .push () .replace () method in main.js or router.js files, and how to write it

that is, use router to jump outside the component. Tried many times, either it didn"t work or reported an error

Mar.23,2021

main.js:

// ...
new Vue({
  el: '-sharpapp',
  router,
  store,
  components: { App },
  template: '<App/>',
  created () {
    this.$router.push('/login')
  }
})

route.js:

// ...
const route = new Router({
    routes: [
        {path: '/'},
        {path: '/login'}
    ]
})
route.push('/login')
export default route

other.js:

import route from 'route.js'
route.push('/login')

first quote router

that you have written.

let testVueInstance = new Vue({
  el: '-sharpapp',
  router,
  store,
  VueI18n,
  template: '<App/>',
  components: {
    App
  }
})
testVueInstance.$router.push('/abc')

Save the root instance of new in main.js and use this instance to call the method.

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-1e4d745-4c63d.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-1e4d745-4c63d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?