How to implement jump routing by public methods in vue

now it will be encapsulated in a js file. Axios wants to uniformly handle the status of the query here. Permission handling (for example, jump to the login page without permission and modify the status in store). How can I call a method like this.$route this.$store

in this public js file?

I think some projects of others have created another instance in the public method

const vue = new Vue({
    store,
    router
});

Jump and change are implemented through vue.$store vue.$route, which is equivalent to creating two new vue objects. Why can you do this

is there any other way

Mar.22,2021

main.js

  

have you solved it?

Menu