README.md 2.68 KB
Newer Older
1
# vue-admin-template
Pan's avatar
Pan committed
2

Pan's avatar
Pan committed
3
> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint
Pan's avatar
Pan committed
4

5
**Live demo:** http://panjiachen.github.io/vue-admin-template
Pan's avatar
Pan committed
6

Pan's avatar
Pan committed
7
[中文文档](https://github.com/PanJiaChen/vue-admin-template/blob/master/README-zh.md)
Pan's avatar
Pan committed
8 9 10

## Build Setup

11
```bash
Pan's avatar
Pan committed
12
# Clone project
Pan's avatar
Pan committed
13
git clone https://github.com/PanJiaChen/vue-admin-template.git
Pan's avatar
Pan committed
14 15

# Install dependencies
Pan's avatar
Pan committed
16 17
npm install

18
# Serve with hot reload at localhost:9528
Pan's avatar
Pan committed
19 20
npm run dev

21
# Build for production with minification
Pan's avatar
Pan committed
22 23
npm run build

24
# Build for production and view the bundle analyzer report
Pan's avatar
Pan committed
25 26 27
npm run build --report
```

Pan's avatar
Pan committed
28
## Demo
29

Pan's avatar
Pan committed
30
![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
Pan's avatar
Pan committed
31

Pan's avatar
Pan committed
32
## Extra
33

Pan's avatar
Pan committed
34
If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control)
Pan's avatar
Pan committed
35

Pan's avatar
Pan committed
36
This project is based on `webpack4` development. If you want to use `webpack3` development, please use this branch [webpack3](https://github.com/PanJiaChen/vue-admin-template/tree/webpack3)
37

38 39
For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour))

Pan's avatar
Pan committed
40 41
## Related Project

42 43 44
[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)

[electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
Pan's avatar
Pan committed
45

46 47
[vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template)

48
### Element-Ui using cdn tutorial
49

Pan's avatar
Pan committed
50
First find `index.html`([root directory](https://github.com/PanJiaChen/vue-admin-template/blob/element-ui-cdn/index.html))
51 52 53

Import css and js of `Element`, and then import vue. Because `Element` is vue-dependent, vue must be import before it.

Pan's avatar
Pan committed
54
Then find [webpack.base.conf.js](https://github.com/PanJiaChen/vue-admin-template/blob/element-ui-cdn/build/webpack.base.conf.js)
55 56 57 58 59 60 61 62 63 64
Add `externals` to make webpack not package vue and element.

```
externals: {
  vue: 'Vue',
  'element-ui':'ELEMENT'
}
```

Finally there is a small detail to pay attention to that if you import vue in global, you don't need to manually `Vue.use(Vuex)`, it will be automatically mounted, see
65
[issue](https://github.com/vuejs/vuex/issues/731)
66 67 68 69 70 71

And you can use `npm run build --report` to see the effect

Pictured:
![demo](https://panjiachen.github.io/images/element-cdn.png)

Pan's avatar
Pan committed
72
**[Detailed code](https://github.com/PanJiaChen/vue-admin-template/commit/746aff560932704ae821f82f10b8b2a9681d5177)**
73

Pan's avatar
Pan committed
74
**[Branch](https://github.com/PanJiaChen/vue-admin-template/tree/element-ui-cdn)**
75

Pan's avatar
Pan committed
76
## License
77

Pan's avatar
Pan committed
78
[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license.
Pan's avatar
Pan committed
79 80

Copyright (c) 2017-present PanJiaChen