我的索引路由定义为:
{ path: '/', adminOnly: false, component: Main },
Run Code Online (Sandbox Code Playgroud)
有没有办法访问'adminOnly'属性?
在这段代码中似乎没有办法这样做:
routes.beforeEach((to, from, next) => {
console.log(to)
next();
});
Run Code Online (Sandbox Code Playgroud)
我的路线档案:
import Vue from 'vue';
import VueRouter from 'vue-router';
import Main from '../components/Main.vue';
import About from '../components/About.vue';
const NotFoundException = {
template: '<div>Route Was Not Found</div>'
};
Vue.use(VueRouter);
const routes = new VueRouter({
mode: 'history',
hashbang: false,
linkActiveClass: 'active',
base: '/jokes',
routes: [
{ path: '/', adminOnly: false, component: Main },
{ path: '/about', adminOnly: false, component: About },
{ path: …Run Code Online (Sandbox Code Playgroud)