How to introduce vue-router into vuex file to get routing information?

if you want to use the meta field data in router in other js files or vuex, how to introduce it?
import router from". / router"
cannot be used after this introduction

Jul.04,2021

solved, it's on the prototype chain of vue, but it's not very elegant.

< hr >

it still doesn't work. Console.log (router.app) comes out as undefined, but there is

in console.log (router).

introduces main.js. It is then referenced from the vue instance exposed in main.js. Either route or vuex is fine.


have you solved it? I have the same problem. When introduced, undefind


this is how I get the current routing path in vuex. I hope it will be helpful to you.

import router from '@/router'
console.log('=>',router.app._route.name);
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-1b30526-2b551.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-1b30526-2b551.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?