Javascript 使用两个路由器的Vue.js
例如,在我的主路由器中,我使用每个路由的通用名称Javascript 使用两个路由器的Vue.js,javascript,vue.js,Javascript,Vue.js,例如,在我的主路由器中,我使用每个路由的通用名称 { path: '/:locale/:id', name: 'mainNavigation', }, 然而,mainNagivation内部包含多个其他路径,具体取决于:id的数量,以及我使用谷歌分析时,比如: Vue.use( VueGtag, { config: { id: 'G-******' } }, router ) 我只得到主导航,但我需要显示每个路径的具体名称。所以我想为Google Analytics创建另一个更详细的
{
path: '/:locale/:id',
name: 'mainNavigation',
},
然而,mainNagivation内部包含多个其他路径,具体取决于:id的数量,以及我使用谷歌分析时,比如:
Vue.use(
VueGtag,
{
config: { id: 'G-******' }
},
router
)
我只得到主导航,但我需要显示每个路径的具体名称。所以我想为Google Analytics创建另一个更详细的路由器,具有更多指定的路径和名称。这样的事行吗?我可以使用多个路由器吗
我确实尝试创建了另一个路由器,名为router2,并将其传递给Google Analytics,但它没有捕获任何内容 创建文件主路由器
import Vue from 'vue';
import Router from 'vue-router';
import interface one from 'interface one'
import interface two from 'interface two'
var allRoutes: any[] = []
const routes = allRoutes.concat(interface one, interface two)
Vue.use(Router);
export default new Router({
routes: routes
});
并创建一个文件接口
import adminHome from 'adminHome'
const routes = [
{
path: '/home',
name: 'home',
component: adminHome
},
]
export default routes
并创建文件接口二
import SupervisorsHome from 'SupervisorsHome'
const routes = [
{
path: '/supervisors/home',
name: 'home',
component: SupervisorsHome
},
]
export default routes