|
|
7 gadi atpakaļ | |
|---|---|---|
| build | 7 gadi atpakaļ | |
| config | 7 gadi atpakaļ | |
| src | 7 gadi atpakaļ | |
| static | 8 gadi atpakaļ | |
| .babelrc | 7 gadi atpakaļ | |
| .editorconfig | 8 gadi atpakaļ | |
| .eslintignore | 8 gadi atpakaļ | |
| .eslintrc.js | 7 gadi atpakaļ | |
| .gitignore | 7 gadi atpakaļ | |
| .postcssrc.js | 7 gadi atpakaļ | |
| .travis.yml | 8 gadi atpakaļ | |
| LICENSE | 7 gadi atpakaļ | |
| README-zh.md | 7 gadi atpakaļ | |
| README.md | 7 gadi atpakaļ | |
| favicon.ico | 8 gadi atpakaļ | |
| index.html | 7 gadi atpakaļ | |
| package.json | 7 gadi atpakaļ |
这是一个 极简的vue admin 管理后台 它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。
如果你想要根据用户角色来动态生成侧边栏和router,你可以使用改分支permission-control ## 相关项目 vue-element-admin
写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目:
# Clone project
git clone https://github.com/PanJiaChen/vueAdmin-template.git
# Install dependencies
npm install
# 建议不要用cnpm 安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# serve with hot reload at localhost:9528
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
首先找到 index.html (根目录下)
引入 Element的css和js ,并且引入 vue 。因为 Element-Ui 是依赖 vue 的,所以必须在它之前引入 vue 。
之后找到 webpack.base.conf.js 加入 externals 让webpack 不打包 vue 和 element
externals: {
vue: 'Vue',
'element-ui':'ELEMENT'
}
之后还有一个小细节是如果你用了全局对象方式引入vue,就不需要 手动 Vue.use(Vuex) ,它会自动挂载,具体见 issue
最终你可以使用 npm run build --report 查看效果
如图:

MIT license.
Copyright (c) 2017-present PanJiaChen