簡體   English   中英

Laravel/Vue - 從后端獲取路由列表

[英]Laravel/Vue - Get list of routes from backend

我在resources/js/router.js中有這個路由器代碼

import Vue from 'vue';
import VueRouter from 'vue-router';

import ClientFeature1 from './components/ClientFeature1';
import ClientFeature2 from './components/ClientFeature2';
import InternalFeature1 from './components/InternalFeature1';
import InternalFeature2 from './components/InternalFeature2';

Vue.use(VueRouter);

export default new VueRouter({
    routes : [
        { path : '/client-1', component : ClientFeature1, name : "Client Feature 1" },
        { path : '/client-2', component : ClientFeature2, name : "Client Feature 2" },
        { path : '/internal-1', component : InternalFeature1, name : "Internal Feature 1" },
        { path : '/internal-2', component : InternalFeature2, name : "Internal Feature 2" }
    ],
    mode: 'hash'
});

這很好用,但正如您所見,我正在為客戶端和僅供內部使用的路由加載所有路由。

如何僅在用戶客戶端或內部使用時加載? 任何建議表示贊賞。

提前致謝。

 export default new VueRouter({ routes: [ { path: '/client-1', name: "Client Feature 1" // component: ClientFeature1, //asis component: () => import(/* webpackChunkName: 'ClientFeature1' */'./components/ClientFeature1') }, //... ], mode: 'hash' });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM