版本依赖情况:
PS D:\suidian-yuexi\admin> npm list vue npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. vue-antd-pro@3.0.2 D:\suidian-yuexi\admin +-- @ant-design-vue/pro-layout@1.0.13 | +-- vue-container-query@0.1.0 | | `-- vue@2.7.3 deduped | +-- vue-copy-to-clipboard@1.0.3 | | `-- vue@2.7.3 deduped | `-- vue@2.7.3 deduped +-- @vue/cli-plugin-babel@4.5.19 | `-- @vue/babel-preset-app@4.5.19 | +-- @vue/babel-preset-jsx@1.3.0 | | `-- vue@2.7.3 deduped | `-- vue@2.7.3 deduped +-- @vue/cli-plugin-unit-jest@4.5.19 | `-- vue-jest@3.0.7 | `-- vue@2.7.3 deduped +-- @vue/test-utils@1.3.0 | `-- vue@2.7.3 deduped +-- ant-design-vue@1.7.8 | +-- @ant-design/icons-vue@2.0.0 | `-- vue@2.7.3 deduped +-- viser-vue@2.4.8 | `-- vue@2.7.3 deduped +-- vue-svg-component-runtime@1.0.1 | `-- vue@2.7.3 deduped +-- vue-svg-icon-loader@2.1.1 | +-- vue-svg-component-builder@2.0.3 | | `-- vue@2.7.3 deduped | `-- vue@2.7.3 deduped +-- vue@2.7.3 `-- vuex@3.6.2 `-- vue@2.7.3 deduped PS D:\suidian-yuexi\admin> npm run serve npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. > vue-antd-pro@3.0.2 serve > vue-cli-service serve
1、修改项目运行路径,打开vue.config.js文件,在vueConfig的json中增加:
publicPath: "/admin2/",
2、修改路由的基础路径,打开index.js文件,在createRouter的new Router对象时传入的json增加:
base: '/admin2',
3、重启服务即可