4

当我尝试从src/Client/App.vue. 我想在同一个域中使用不同的 vue、vuex、vue-router 基础将管理员和用户分开。可能吗?我的项目树。

public/
 -> admin/
   -> index.html
 -> index.hmtl
src/
 -> Admin/
   -> components/
   -> admin.ts
   -> App.vue
   -> router.ts
 -> Client/
   -> components/
   -> admin.ts
   -> App.vue
   -> router.ts
 vue.config.js

src/Admin/router.ts

export default new Router({
  mode: 'history',
  base:   '/admin/', 
  routes: [
    {
      path: '/dashboard',
      name: 'dashboard',
      component: Dashboard,
    },
  ],
});

src/Client/router.ts

export default new Router({
  mode: 'history',
  base:  '/', 
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
    },
  ],
});

vue.config.js

module.exports = {
    pages: {
        'admin': {
            entry: 'src/Admin/admin.ts',
            template: 'public/admin/index.html',
            filename: 'admin/index.html',
        },

        index: {
            entry: 'src/Client/main.ts',
            template: 'public/index.html',
            filename: 'index.html',
        },
    }
}
4

0 回答 0