vueComponent / ant-design-vue-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design Vue like a Pro! (vue2)
https://pro.antdv.com
MIT License
10.7k stars 3.1k forks source link

后端返回菜单数据,构建动态路由时,加载不了基础组件 #1169

Open pylixm opened 3 years ago

pylixm commented 3 years ago

Question (问题描述) 加载基础组件有问题,为undefined 。我看了这个问题,没什么思路:https://github.com/vueComponent/ant-design-vue-pro/issues/592

image

后端返回和前端配置和官方文档一样:https://pro.antdv.com/docs/authority-management#%E5%8A%A8%E6%80%81%E8%B7%AF%E7%94%B1

Describe the solution you'd like (你期待的是什么?) 正常加载基础组件

Additional context(附加信息)

环境如下:

dependencies: {
    '@antv/data-set': '^0.10.1',
    'ant-design-vue': '~1.3.7',
    axios: '^0.18.0',
    'enquire.js': '^2.1.6',
    'js-cookie': '^2.2.0',
    'lodash.get': '^4.4.2',
    'lodash.pick': '^4.4.0',
    md5: '^2.2.1',
    moment: '^2.24.0',
    nprogress: '^0.2.0',
    'viser-vue': '^2.3.3',
    vue: '^2.5.22',
    'vue-clipboard2': '^0.2.1',
    'vue-cropper': '0.4.4',
    'vue-ls': '^3.2.0',
    'vue-router': '^3.0.1',
    'vue-svg-component-runtime': '^1.0.1',
    vuex: '^3.1.0'
  },
  devDependencies: {
    '@babel/polyfill': '^7.2.5',
    '@vue/cli-plugin-babel': '^3.3.0',
    '@vue/cli-plugin-eslint': '^3.3.0',
    '@vue/cli-plugin-unit-jest': '^3.3.0',
    '@vue/cli-service': '^3.3.0',
    '@vue/eslint-config-standard': '^4.0.0',
    '@vue/test-utils': '^1.0.0-beta.20',
    'babel-core': '7.0.0-bridge.0',
    'babel-eslint': '^10.0.1',
    'babel-jest': '^23.6.0',
    'babel-plugin-import': '^1.11.0',
    eslint: '^5.8.0',
    'eslint-plugin-html': '^5.0.0',
    'eslint-plugin-vue': '^5.0.0',
    less: '^3.8.1',
    'less-loader': '^4.1.0',
    'vue-svg-icon-loader': '^2.1.1',
    'vue-template-compiler': '^2.5.22',
    opencollective: '^1.0.3',
    'opencollective-postinstall': '^2.0.2'
  }
sendya commented 3 years ago

提供在线的最小复现,或仓库 否则无法帮你看到为什么

whuimin commented 3 years ago

我也遇到了这个问题,后来我把src\layouts\index.js文件中的内容改为下面的方式就好了。 const UserLayout = () => import('./UserLayout') const BlankLayout = () => import('./BlankLayout') const BasicLayout = () => import('./BasicLayout') const RouteView = () => import('./RouteView') const PageView = () => import('./PageView')