diff --git a/.babelrc b/.babelrc
index 41789cac..b4050098 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,5 +1,8 @@
{
- "presets": ["es2015", "stage-2"],
+ "presets": [
+ ["env", { "modules": false }],
+ "stage-2"
+ ],
"plugins": ["transform-runtime"],
"comments": false
}
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..ea6e20f5
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,14 @@
+# http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false
diff --git a/.eslintrc.js b/.eslintrc.js
index a388ba27..006e9824 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -6,7 +6,8 @@ module.exports = {
},
env: {
browser: true,
- node: true
+ node: true,
+ es6: true,
},
extends: 'eslint:recommended',
// required to lint *.vue files
@@ -22,297 +23,122 @@ module.exports = {
}
},
// add your custom rules here
+ //it is base on https://github.com/vuejs/eslint-config-vue
'rules': {
- // don't require .vue extension when importing
- // 'import/extensions': ['error', 'always', {
- // 'js': 'never',
- // 'vue': 'never'
- // }],
- // allow debugger during development
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
- /*
- * Possible Errors
- */
-
- // disallow unnecessary parentheses
- 'no-extra-parens': ['error', 'all', {'nestedBinaryExpressions': false}],
-
- // disallow negating the left operand of relational operators
- 'no-unsafe-negation': 'error',
-
- // enforce valid JSDoc comments
- 'valid-jsdoc': 'off',
-
- /*
- * Best Practices
- */
-
- // enforce return statements in callbacks of array methods
- 'array-callback-return': 'error',
-
- // enforce consistent brace style for all control statements
- curly: ['error', 'multi-line'],
-
- // enforce consistent newlines before and after dots
- 'dot-location': ['error', 'property'],
-
- // enforce dot notation whenever possible
- 'dot-notation': 'error',
-
- // require the use of === and !==
- 'eqeqeq': ['error', 'smart'],
-
- // disallow the use of arguments.caller or arguments.callee
- 'no-caller': 'error',
-
- // disallow empty functions
- 'no-empty-function': 'error',
-
- // disallow unnecessary calls to .bind()
- 'no-extra-bind': 'error',
-
- // disallow unnecessary labels
- 'no-extra-label': 'error',
-
- // disallow leading or trailing decimal points in numeric literals
- 'no-floating-decimal': 'error',
-
- // disallow assignments to native objects or read-only global variables
- 'no-global-assign': 'error',
-
- // disallow the use of eval()-like methods
- 'no-implied-eval': 'error',
-
- // disallow the use of the __iterator__ property
- 'no-iterator': 'error',
-
- // disallow unnecessary nested blocks
- 'no-lone-blocks': 'error',
-
- // disallow multiple spaces
- 'no-multi-spaces': 'error',
-
- // disallow new operators with the String, Number, and Boolean objects
- 'no-new-wrappers': 'error',
-
- // disallow octal escape sequences in string literals
- 'no-octal-escape': 'error',
-
- // disallow the use of the __proto__ property
- 'no-proto': 'error',
-
- // disallow comparisons where both sides are exactly the same
- 'no-self-compare': 'error',
-
- // disallow throwing literals as exceptions
- 'no-throw-literal': 'error',
-
- // disallow unused expressions
- 'no-unused-expressions': 'error',
-
- // disallow unnecessary calls to .call() and .apply()
- 'no-useless-call': 'error',
-
- // disallow unnecessary concatenation of literals or template literals
- 'no-useless-concat': 'error',
-
- // disallow unnecessary escape characters
- 'no-useless-escape': 'error',
-
- // disallow void operators
- 'no-void': 'error',
-
- // require parentheses around immediate function invocations
- 'wrap-iife': 'error',
-
- // require or disallow “Yoda” conditions
- yoda: 'error',
-
- /*
- * Variables
- */
-
- // disallow labels that share a name with a variable
- 'no-label-var': 'error',
-
- // disallow initializing variables to undefined
- 'no-undef-init': 'error',
- 'no-undef': 'off',
- // disallow the use of variables before they are defined
- 'no-use-before-define': 'error',
-
- /*
- * Node.js and CommonJS
- */
-
- // disallow new operators with calls to require
- 'no-new-require': 'error',
-
- /*
- * Stylistic Issues
- */
-
- // enforce consistent spacing inside array brackets
- 'array-bracket-spacing': 'error',
-
- // enforce consistent spacing inside single-line blocks
- 'block-spacing': 'error',
-
- // enforce consistent brace style for blocks
- 'brace-style': ['error', '1tbs', {'allowSingleLine': true}],
-
- // require or disallow trailing commas
- 'comma-dangle': 'error',
-
- // enforce consistent spacing before and after commas
- 'comma-spacing': 'error',
-
- // enforce consistent comma style
- 'comma-style': 'error',
-
- // enforce consistent spacing inside computed property brackets
- 'computed-property-spacing': 'error',
-
- // require or disallow spacing between function identifiers and their invocations
- 'func-call-spacing': 'error',
-
- // enforce consistent indentation
- indent: ['error', 2, {SwitchCase: 1}],
-
- // enforce the consistent use of either double or single quotes in JSX attributes
- 'jsx-quotes': 'error',
-
- // enforce consistent spacing between keys and values in object literal properties
- 'key-spacing': 'error',
-
- // enforce consistent spacing before and after keywords
- 'keyword-spacing': 'error',
-
- // enforce consistent linebreak style
- 'linebreak-style': 'error',
-
- // require or disallow newlines around directives
- 'lines-around-directive': 'error',
-
- // require constructor names to begin with a capital letter
- 'new-cap': 'off',
-
- // require parentheses when invoking a constructor with no arguments
- 'new-parens': 'error',
-
- // disallow Array constructors
- 'no-array-constructor': 'error',
-
- // disallow Object constructors
- 'no-new-object': 'error',
-
- // disallow trailing whitespace at the end of lines
- 'no-trailing-spaces': 'error',
-
- // disallow ternary operators when simpler alternatives exist
- 'no-unneeded-ternary': 'error',
-
- // disallow whitespace before properties
- 'no-whitespace-before-property': 'error',
-
- // enforce consistent spacing inside braces
- 'object-curly-spacing': ['error', 'always'],
-
- // require or disallow padding within blocks
- 'padded-blocks': ['error', 'never'],
-
- // require quotes around object literal property names
- 'quote-props': ['error', 'as-needed'],
-
- // enforce the consistent use of either backticks, double, or single quotes
- quotes: ['error', 'single'],
-
- // enforce consistent spacing before and after semicolons
- 'semi-spacing': 'error',
-
- // require or disallow semicolons instead of ASI
- // semi: ['error', 'never'],
-
- // enforce consistent spacing before blocks
- 'space-before-blocks': 'error',
-
+ 'accessor-pairs': 2,
+ 'arrow-spacing': [2, { 'before': true, 'after': true }],
+ 'block-spacing': [2, 'always'],
+ 'brace-style': [2, '1tbs', { 'allowSingleLine': true }],
+ 'camelcase': [0, { 'properties': 'always' }],
+ 'comma-dangle': [2, 'never'],
+ 'comma-spacing': [2, { 'before': false, 'after': true }],
+ 'comma-style': [2, 'last'],
+ 'constructor-super': 2,
+ 'curly': [2, 'multi-line'],
+ 'dot-location': [2, 'property'],
+ 'eol-last': 2,
+ 'eqeqeq': [2, 'allow-null'],
+ 'generator-star-spacing': [2, { 'before': true, 'after': true }],
+ 'handle-callback-err': [2, '^(err|error)$' ],
+ 'indent': [2, 2, { 'SwitchCase': 1 }],
+ 'jsx-quotes': [2, 'prefer-single'],
+ 'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }],
+ 'keyword-spacing': [2, { 'before': true, 'after': true }],
+ 'new-cap': [2, { 'newIsCap': true, 'capIsNew': false }],
+ 'new-parens': 2,
+ 'no-array-constructor': 2,
+ 'no-caller': 2,
'no-console': 'off',
-
- // enforce consistent spacing before function definition opening parenthesis
- 'space-before-function-paren': ['error', 'never'],
-
- // enforce consistent spacing inside parentheses
- 'space-in-parens': 'error',
-
- // require spacing around infix operators
- 'space-infix-ops': 'error',
-
- // enforce consistent spacing before or after unary operators
- 'space-unary-ops': 'error',
-
- // enforce consistent spacing after the // or /* in a comment
- 'spaced-comment': 'error',
-
- // require or disallow Unicode byte order mark (BOM)
- 'unicode-bom': 'error',
-
-
- /*
- * ECMAScript 6
- */
-
- // require braces around arrow function bodies
- 'arrow-body-style': 'error',
-
- // require parentheses around arrow function arguments
- 'arrow-parens': ['error', 'as-needed'],
-
- // enforce consistent spacing before and after the arrow in arrow functions
- 'arrow-spacing': 'error',
-
- // enforce consistent spacing around * operators in generator functions
- 'generator-star-spacing': ['error', 'after'],
-
- // disallow duplicate module imports
- 'no-duplicate-imports': 'error',
-
- // disallow unnecessary computed property keys in object literals
- 'no-useless-computed-key': 'error',
-
- // disallow unnecessary constructors
- 'no-useless-constructor': 'error',
-
- // disallow renaming import, export, and destructured assignments to the same name
- 'no-useless-rename': 'error',
-
- // require let or const instead of var
- 'no-var': 'error',
-
- // require or disallow method and property shorthand syntax for object literals
- 'object-shorthand': 'error',
-
- // require arrow functions as callbacks
- 'prefer-arrow-callback': 'error',
-
- // require const declarations for variables that are never reassigned after declared
- 'prefer-const': 'error',
-
- // disallow parseInt() in favor of binary, octal, and hexadecimal literals
- 'prefer-numeric-literals': 'error',
-
- // require rest parameters instead of arguments
- 'prefer-rest-params': 'error',
-
- // require spread operators instead of .apply()
- 'prefer-spread': 'error',
-
- // enforce spacing between rest and spread operators and their expressions
- 'rest-spread-spacing': 'error',
-
- // require or disallow spacing around embedded expressions of template strings
- 'template-curly-spacing': 'error',
-
- // require or disallow spacing around the * in yield* expressions
- 'yield-star-spacing': 'error'
+ 'no-class-assign': 2,
+ 'no-cond-assign': 2,
+ 'no-const-assign': 2,
+ 'no-control-regex': 2,
+ 'no-delete-var': 2,
+ 'no-dupe-args': 2,
+ 'no-dupe-class-members': 2,
+ 'no-dupe-keys': 2,
+ 'no-duplicate-case': 2,
+ 'no-empty-character-class': 2,
+ 'no-empty-pattern': 2,
+ 'no-eval': 2,
+ 'no-ex-assign': 2,
+ 'no-extend-native': 2,
+ 'no-extra-bind': 2,
+ 'no-extra-boolean-cast': 2,
+ 'no-extra-parens': [2, 'functions'],
+ 'no-fallthrough': 2,
+ 'no-floating-decimal': 2,
+ 'no-func-assign': 2,
+ 'no-implied-eval': 2,
+ 'no-inner-declarations': [2, 'functions'],
+ 'no-invalid-regexp': 2,
+ 'no-irregular-whitespace': 2,
+ 'no-iterator': 2,
+ 'no-label-var': 2,
+ 'no-labels': [2, { 'allowLoop': false, 'allowSwitch': false }],
+ 'no-lone-blocks': 2,
+ 'no-mixed-spaces-and-tabs': 2,
+ 'no-multi-spaces': 2,
+ 'no-multi-str': 2,
+ 'no-multiple-empty-lines': [2, { 'max': 1 }],
+ 'no-native-reassign': 2,
+ 'no-negated-in-lhs': 2,
+ 'no-new-object': 2,
+ 'no-new-require': 2,
+ 'no-new-symbol': 2,
+ 'no-new-wrappers': 2,
+ 'no-obj-calls': 2,
+ 'no-octal': 2,
+ 'no-octal-escape': 2,
+ 'no-path-concat': 2,
+ 'no-proto': 2,
+ 'no-redeclare': 2,
+ 'no-regex-spaces': 2,
+ 'no-return-assign': [2, 'except-parens'],
+ 'no-self-assign': 2,
+ 'no-self-compare': 2,
+ 'no-sequences': 2,
+ 'no-shadow-restricted-names': 2,
+ 'no-spaced-func': 2,
+ 'no-sparse-arrays': 2,
+ 'no-this-before-super': 2,
+ 'no-throw-literal': 2,
+ 'no-trailing-spaces': 2,
+ 'no-undef': 2,
+ 'no-undef-init': 2,
+ 'no-unexpected-multiline': 2,
+ 'no-unmodified-loop-condition': 2,
+ 'no-unneeded-ternary': [2, { 'defaultAssignment': false }],
+ 'no-unreachable': 2,
+ 'no-unsafe-finally': 2,
+ 'no-unused-vars': [2, { 'vars': 'all', 'args': 'none' }],
+ 'no-useless-call': 2,
+ 'no-useless-computed-key': 2,
+ 'no-useless-constructor': 2,
+ 'no-useless-escape': 0,
+ 'no-whitespace-before-property': 2,
+ 'no-with': 2,
+ 'one-var': [2, { 'initialized': 'never' }],
+ 'operator-linebreak': [2, 'after', { 'overrides': { '?': 'before', ':': 'before' } }],
+ 'padded-blocks': [2, 'never'],
+ 'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
+ 'semi': [2, 'never'],
+ 'semi-spacing': [2, { 'before': false, 'after': true }],
+ 'space-before-blocks': [2, 'always'],
+ 'space-before-function-paren': [2, 'never'],
+ 'space-in-parens': [2, 'never'],
+ 'space-infix-ops': 2,
+ 'space-unary-ops': [2, { 'words': true, 'nonwords': false }],
+ 'spaced-comment': [2, 'always', { 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] }],
+ 'template-curly-spacing': [2, 'never'],
+ 'use-isnan': 2,
+ 'valid-typeof': 2,
+ 'wrap-iife': [2, 'any'],
+ 'yield-star-spacing': [2, 'both'],
+ 'yoda': [2, 'never'],
+ 'prefer-const': 2,
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+ 'object-curly-spacing': [2, 'always', { objectsInObjects: false }],
+ 'array-bracket-spacing': [2, 'never']
}
}
diff --git a/.gitignore b/.gitignore
index 19131cc3..a5060b02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@
node_modules/
dist/
static/ckeditor
-
+gifs/
npm-debug.log
test/unit/coverage
test/e2e/reports
diff --git a/.postcssrc.js b/.postcssrc.js
new file mode 100644
index 00000000..ea9a5ab8
--- /dev/null
+++ b/.postcssrc.js
@@ -0,0 +1,8 @@
+// https://github.com/michael-ciniawsky/postcss-load-config
+
+module.exports = {
+ "plugins": {
+ // to edit target browsers: use "browserlist" field in package.json
+ "autoprefixer": {}
+ }
+}
diff --git a/README-en.md b/README-en.md
index 6ec251fc..39d4c892 100644
--- a/README-en.md
+++ b/README-en.md
@@ -1,29 +1,19 @@
+[](https://github.com/vuejs/vue)
+[](https://github.com/ElemeFE/element)
+[](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
+[]()
+
## Intro
> In the past half year, I have been building a backend for management dashboard using Vue. Though the backend has contained greater than 70 pages and over 10 permissions, it still takes insignificant effort to maintain the project. So I decide to make it open source so as to share my development experience and progress on backend. The tech stack is mainly [Vue.js](https://github.com/vuejs/vue)+[Element](https://github.com/ElemeFE/element)+[axios](https://github.com/mzabriskie/axios). Since it's a personal project, all data requests are simulated with [Mock.js](https://github.com/nuysoft/Mock). **Note:** if anyone wants to modify or develop based on this project, please remove the mock files.
**Live demo:** http://panjiachen.github.io/vue-element-admin
-**Note: element-ui@1.3.3 is used in the project, so vue 2.3.0+ is required.**
+**Note: element-ui@1.4.2 is used in the project, so vue 2.3.0+ is required.**
-More tutorials incoming. Including articles on:
-
-- How to build structure of a backend dashboard project from scratch
-- How to make a complete user system (e.g. permission authentication, two-factor authentication)
-- How to package components (e.g. rich text)
-- How to integrate with [Qiniu](https://www.qiniu.com/)
-- Other development experience on backend
-
-Join the group on QQ 591724180.
-
-**Tutorials:**
-
-- [Wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
-- [Step by step instructions on playing with backend using Vue Part 1 - Fundamentals](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
-- [Step by step instructions on playing with backend using Vue Part 2 - Login permission](https://juejin.im/post/591aa14f570c35006961acac)
-- [Step by step instructions on packaging a Vue component](https://segmentfault.com/a/1190000009090836)
-
-**Please read the Wiki and articles above before creating any issue. Feel free to contribute by making a pull request.**
+ - vueAdmin-template: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
+ - electron-vue-admin: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
+ - Donate:[donate](https://github.com/PanJiaChen/vue-element-admin/blob/master/README-en.md#donate)
## Features
@@ -43,6 +33,7 @@ Join the group on QQ 591724180.
- 401, 404 error page
- Error log
- Exporting to Excel
+- Upload Excel
- Table example
- Interactive table example
- Drag & drop table example
@@ -52,6 +43,10 @@ Join the group on QQ 591724180.
- Two-factor authentication
- Collapsing sidebar (support nested routes)
- Mock data
+- cache tabs example
+- screenfull
+- markdown2html
+- views-tab
## Development
@@ -101,7 +96,6 @@ npm run build:prod
│ ├── App.vue // entry view
│ └── main.js // entry for loading components, initialization
├── static // third-party libraries not packed with Webpack
-│ ├── jquery
│ └── Tinymce // rich text
├── .babelrc // babel-loader config
├── eslintrc.js // eslint config
@@ -114,6 +108,10 @@ npm run build:prod
## Changelog
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
+## Donate
+If you find this project useful, you can buy me a cup of coffee
+
+
## State Management
Only status of user and app configuration is managed by Vuex. Other data are managed by their own business pages.
@@ -128,6 +126,10 @@ Only status of user and app configuration is managed by Vuex. Other data are man

+#### tabs
+
+
+
#### Collapsing sidebar

@@ -167,3 +169,7 @@ Only status of user and app configuration is managed by Vuex. Other data are man
#### More
http://panjiachen.github.io/vue-element-admin
+
+## License
+
+MIT
diff --git a/README.md b/README.md
index 7bd62b5d..34e78b92 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,50 @@
# vue-element-admin #
+
+[](https://github.com/vuejs/vue)
+[](https://github.com/ElemeFE/element)
+[](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
+[]()
+
+
[线上地址](http://panjiachen.github.io/vue-element-admin)
[English Document](https://github.com/PanJiaChen/vue-element-admin/blob/master/README-en.md)
[wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
-**注意:该项目目前使用element-ui@1.3.3版本,所以最低兼容 Vue 2.3.0**
+[donate](https://github.com/PanJiaChen/vue-element-admin#donate)
+
+**本项目的定位是后台集成方案,不适合当基础模板来开发。**
+ - 模板建议使用: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
+ - 桌面端: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
+
+
+
+**注意:该项目目前使用element-ui@1.4.2版本,所以最低兼容 Vue 2.3.0**
## 前言
-> 这半年来一直在用vue写管理后台,目前后台已经有七十多个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios.由于是个人项目,所以数据请求都是用了mockjs模拟。注意:在次项目基础上改造开发时请移除mock文件。
+> 这半年来一直在用vue写管理后台,目前后台已经有百来个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios由webpack2打包。由于是个人项目,所以数据请求都是用了mockjs模拟。注意:在此项目基础上改造开发时请移除mock文件。
-后续会出一系列的教程配套文章,如如何从零构建后台项目框架,如何做完整的用户系统(如权限验证,二次登录等),如何二次开发组件(如富文本),如何整合七牛等等文章,各种后台开发经验等等。莫急~~
-相应需求,开了一个qq群 591724180 方便大家交流
+写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目:
- [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac)
- - [ 手摸手,带你封装一个vue component](https://segmentfault.com/a/1190000009090836)
+ - [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35)
+ - [手摸手,带你用vue撸后台 系列四(vueAdmin 一个极简的后台基础模板)](https://juejin.im/post/595b4d776fb9a06bbe7dba56)
+ - [手摸手,带你封装一个vue component](https://segmentfault.com/a/1190000009090836)
+ 相应需求,开了一个qq群 `591724180` 方便大家交流
+
+ 或者可以加入该 **[圈子](https://jianshiapp.com/circles/1209)** 讨论问题
+
+ **如有问题请先看上述文章和Wiki,若不能满足,欢迎 issue 和 pr**
+
+ **该项目并不是一个脚手架,更倾向于是一个集成解决方案**
+
+ **该项目不支持低版本游览器(如ie),有需求请自行添加polyfill [详情](https://github.com/PanJiaChen/vue-element-admin/wiki#babel-polyfill)**
- **如有问题请先看上述问题和Wiki,不能满足,欢迎issue和pr~**
## 功能
- 登录/注销
@@ -36,18 +60,24 @@
- Sticky
- CountTo
- echarts图表
-- 401,401错误页面
+- 401,404错误页面
- 错误日志
- 导出excel
+- 前端可视化excel
- table example
- 动态table example
- 拖拽table example
+- 内联编辑table example
- form example
- 多环境发布
- dashboard
- 二次登录
- 动态侧边栏(支持多级路由)
- mock数据
+- cache tabs example
+- screenfull
+- markdown2html
+- views-tab
## 开发
@@ -93,7 +123,6 @@
│ ├── App.vue // 入口页面
│ └── main.js // 入口 加载组件 初始化等
├── static // 第三方不打包资源
-│ ├── jquery
│ └── Tinymce // 富文本
├── .babelrc // babel-loader 配置
├── eslintrc.js // eslint 配置项
@@ -107,6 +136,10 @@
## Changelog
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
+## Donate
+If you find this project useful, you can buy me a cup of coffee
+
+
## 状态管理
后台只有user和app配置相关状态使用vuex存在全局,其它数据都由每个业务页面自己管理。
@@ -121,6 +154,10 @@ Detailed changes for each release are documented in the [release notes](https://

+#### tabs
+
+
+
#### 可收起侧边栏
@@ -165,5 +202,8 @@ Detailed changes for each release are documented in the [release notes](https://

-## [更多demo](http://panjiachen.github.io/vue-element-admin)
+## [查看更多demo](http://panjiachen.github.io/vue-element-admin)
+## License
+
+MIT
diff --git a/build/utils.js b/build/utils.js
index d3aaebb0..b1d54b4d 100644
--- a/build/utils.js
+++ b/build/utils.js
@@ -3,69 +3,69 @@ var config = require('../config')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
exports.assetsPath = function (_path) {
- var assetsSubDirectory = process.env.NODE_ENV === 'production'
- ? config.build.assetsSubDirectory
- : config.dev.assetsSubDirectory
- return path.posix.join(assetsSubDirectory, _path)
+ var assetsSubDirectory = process.env.NODE_ENV === 'production'
+ ? config.build.assetsSubDirectory
+ : config.dev.assetsSubDirectory
+ return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
- options = options || {}
+ options = options || {}
- var cssLoader = {
- loader: 'css-loader',
- options: {
- minimize: process.env.NODE_ENV === 'production',
- sourceMap: options.sourceMap
- }
+ var cssLoader = {
+ loader: 'css-loader',
+ options: {
+ minimize: process.env.NODE_ENV === 'production',
+ sourceMap: options.sourceMap
+ }
+ }
+
+ // generate loader string to be used with extract text plugin
+ function generateLoaders (loader, loaderOptions) {
+ var loaders = [cssLoader]
+ if (loader) {
+ loaders.push({
+ loader: loader + '-loader',
+ options: Object.assign({}, loaderOptions, {
+ sourceMap: options.sourceMap
+ })
+ })
}
- // generate loader string to be used with extract text plugin
- function generateLoaders(loader, loaderOptions) {
- var loaders = [cssLoader]
- if (loader) {
- loaders.push({
- loader: loader + '-loader',
- options: Object.assign({}, loaderOptions, {
- sourceMap: options.sourceMap
- })
- })
- }
-
- // Extract CSS when that option is specified
- // (which is the case during production build)
- if (options.extract) {
- return ExtractTextPlugin.extract({
- use: loaders,
- fallback: 'vue-style-loader'
- })
- } else {
- return ['vue-style-loader'].concat(loaders)
- }
+ // Extract CSS when that option is specified
+ // (which is the case during production build)
+ if (options.extract) {
+ return ExtractTextPlugin.extract({
+ use: loaders,
+ fallback: 'vue-style-loader'
+ })
+ } else {
+ return ['vue-style-loader'].concat(loaders)
}
+ }
- // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
- return {
- css: generateLoaders(),
- postcss: generateLoaders(),
- less: generateLoaders('less'),
- sass: generateLoaders('sass', {indentedSyntax: true}),
- scss: generateLoaders('sass'),
- stylus: generateLoaders('stylus'),
- styl: generateLoaders('stylus')
- }
+ // https://vue-loader.vuejs.org/en/configurations/extract-css.html
+ return {
+ css: generateLoaders(),
+ postcss: generateLoaders(),
+ less: generateLoaders('less'),
+ sass: generateLoaders('sass', { indentedSyntax: true }),
+ scss: generateLoaders('sass'),
+ stylus: generateLoaders('stylus'),
+ styl: generateLoaders('stylus')
+ }
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
- var output = []
- var loaders = exports.cssLoaders(options)
- for (var extension in loaders) {
- var loader = loaders[extension]
- output.push({
- test: new RegExp('\\.' + extension + '$'),
- use: loader
- })
- }
- return output
+ var output = []
+ var loaders = exports.cssLoaders(options)
+ for (var extension in loaders) {
+ var loader = loaders[extension]
+ output.push({
+ test: new RegExp('\\.' + extension + '$'),
+ use: loader
+ })
+ }
+ return output
}
diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index 64fe3303..d82a880c 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -1,85 +1,92 @@
-var path = require('path');
-var utils = require('./utils');
-var config = require('../config');
-var vueLoaderConfig = require('./vue-loader.conf');
+var path = require('path')
+var utils = require('./utils')
+var config = require('../config')
+var vueLoaderConfig = require('./vue-loader.conf')
function resolve(dir) {
- return path.join(__dirname, '..', dir)
+ return path.join(__dirname, '..', dir)
}
-var src = path.resolve(__dirname, '../src');
module.exports = {
- entry: {
- app: './src/main.js'
- },
- output: {
- path: config.build.assetsRoot,
- filename: '[name].js',
- publicPath: process.env.NODE_ENV !== 'development' ? config.build.assetsPublicPath: config.dev.assetsPublicPath
- },
- resolve: {
- extensions: ['.js', '.vue', '.json'],
- alias: {
- 'vue$': 'vue/dist/vue.esm.js',
- '@': resolve('src'),
- 'src': path.resolve(__dirname, '../src'),
- 'assets': path.resolve(__dirname, '../src/assets'),
- 'components': path.resolve(__dirname, '../src/components'),
- 'views': path.resolve(__dirname, '../src/views'),
- 'styles': path.resolve(__dirname, '../src/styles'),
- 'api': path.resolve(__dirname, '../src/api'),
- 'utils': path.resolve(__dirname, '../src/utils'),
- 'store': path.resolve(__dirname, '../src/store'),
- 'router': path.resolve(__dirname, '../src/router'),
- 'mock': path.resolve(__dirname, '../src/mock'),
- 'vendor': path.resolve(__dirname, '../src/vendor'),
- 'static': path.resolve(__dirname, '../static')
+ entry: {
+ app: './src/main.js'
+ },
+ output: {
+ path: config.build.assetsRoot,
+ filename: '[name].js',
+ publicPath: process.env.NODE_ENV !== 'development' ? config.build.assetsPublicPath : config.dev.assetsPublicPath
+ },
+ resolve: {
+ extensions: ['.js', '.vue', '.json'],
+ alias: {
+ 'vue$': 'vue/dist/vue.esm.js',
+ '@': resolve('src'),
+ 'src': path.resolve(__dirname, '../src'),
+ 'assets': path.resolve(__dirname, '../src/assets'),
+ 'components': path.resolve(__dirname, '../src/components'),
+ 'views': path.resolve(__dirname, '../src/views'),
+ 'styles': path.resolve(__dirname, '../src/styles'),
+ 'api': path.resolve(__dirname, '../src/api'),
+ 'utils': path.resolve(__dirname, '../src/utils'),
+ 'store': path.resolve(__dirname, '../src/store'),
+ 'router': path.resolve(__dirname, '../src/router'),
+ 'mock': path.resolve(__dirname, '../src/mock'),
+ 'vendor': path.resolve(__dirname, '../src/vendor'),
+ 'static': path.resolve(__dirname, '../static')
+ }
+ },
+ module: {
+ rules: [
+ {
+ test: /\.(js|vue)$/,
+ loader: 'eslint-loader',
+ enforce: "pre",
+ include: [resolve('src'), resolve('test')],
+ options: {
+ formatter: require('eslint-friendly-formatter')
+ }
+ },
+ {
+ test: /\.vue$/,
+ loader: 'vue-loader',
+ options: vueLoaderConfig
+ },
+ {
+ test: /\.js$/,
+ loader: 'babel-loader?cacheDirectory',
+ include: [resolve('src'), resolve('test')]
+ },
+ {
+ test: /\.svg$/,
+ loader: 'svg-sprite-loader',
+ include: [resolve('src/icons')],
+ options: {
+ symbolId: 'icon-[name]'
}
- },
- externals: {
- jquery: 'jQuery'
- },
- module: {
- rules: [
- // {
- // test: /\.(js|vue)$/,
- // loader: 'eslint-loader',
- // enforce: "pre",
- // include: [resolve('src'), resolve('test')],
- // options: {
- // formatter: require('eslint-friendly-formatter')
- // }
- // },
- { test: /\.vue$/,
- loader: 'vue-loader',
- options: vueLoaderConfig
- },
- {
- test: /\.js$/,
- loader: 'babel-loader?cacheDirectory',
- include: [resolve('src'), resolve('test')]
- },
- {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- query: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
- }
- }
- ]
- },
- //注入全局mixin
- // sassResources: path.join(__dirname, '../src/styles/mixin.scss'),
- // sassLoader: {
- // data: path.join(__dirname, '../src/styles/index.scss')
- // },
+ },
+ {
+ test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
+ loader: 'url-loader',
+ exclude: [resolve('src/icons')],
+ options: {
+ limit: 10000,
+ name: utils.assetsPath('img/[name].[hash:7].[ext]')
+ }
+ },
+ {
+ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
+ loader: 'url-loader',
+ options: {
+ limit: 10000,
+ name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
+ }
+ }
+ ]
+ },
+ //注入全局mixin
+ // sassResources: path.join(__dirname, '../src/styles/mixin.scss'),
+ // sassLoader: {
+ // data: path.join(__dirname, '../src/styles/index.scss')
+ // },
}
+
diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js
index 1cc0a90b..5aec2faf 100644
--- a/build/webpack.dev.conf.js
+++ b/build/webpack.dev.conf.js
@@ -9,39 +9,38 @@ var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
- baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
+ baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
})
function resolveApp(relativePath) {
- return path.resolve(relativePath);
+ return path.resolve(relativePath);
}
module.exports = merge(baseWebpackConfig, {
- module: {
- rules: utils.styleLoaders({sourceMap: config.dev.cssSourceMap})
- },
- // cheap-source-map is faster for development
- devtool: '#cheap-source-map',
- cache: true,
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': config.dev.env
- }),
- new webpack.ProvidePlugin({
- $: 'jquery',
- 'jQuery': 'jquery'
- }),
- // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
- new webpack.HotModuleReplacementPlugin(),
- new webpack.NoEmitOnErrorsPlugin(),
- // https://github.com/ampedandwired/html-webpack-plugin
- new HtmlWebpackPlugin({
- filename: 'index.html',
- template: 'index.html',
- favicon: resolveApp('favicon.ico'),
- inject: true,
- path:config.dev.staticPath
- }),
- new FriendlyErrorsPlugin()
- ]
+ module: {
+ rules: utils.styleLoaders({
+ sourceMap: config.dev.cssSourceMap
+ })
+ },
+ // cheap-source-map is faster for development
+ devtool: '#cheap-source-map',
+ cache: true,
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env': config.dev.env
+ }),
+ // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
+ new webpack.HotModuleReplacementPlugin(),
+ new webpack.NoEmitOnErrorsPlugin(),
+ // https://github.com/ampedandwired/html-webpack-plugin
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ template: 'index.html',
+ favicon: resolveApp('favicon.ico'),
+ inject: true,
+ path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory
+ }),
+ new FriendlyErrorsPlugin()
+ ]
})
+
diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js
index 6f01fa59..05f84874 100644
--- a/build/webpack.prod.conf.js
+++ b/build/webpack.prod.conf.js
@@ -12,102 +12,106 @@ var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
var env = process.env.NODE_ENV === 'production' ? config.build.prodEnv : config.build.sitEnv
function resolveApp(relativePath) {
- return path.resolve(relativePath);
+ return path.resolve(relativePath);
}
var webpackConfig = merge(baseWebpackConfig, {
- module: {
- rules: utils.styleLoaders({
- sourceMap: config.build.productionSourceMap,
- extract: true
- })
- },
- devtool: config.build.productionSourceMap ? '#source-map' : false,
- output: {
- path: config.build.assetsRoot,
- filename: utils.assetsPath('js/[name].[chunkhash].js'),
- chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
- },
- plugins: [
- // http://vuejs.github.io/vue-loader/en/workflow/production.html
- new webpack.DefinePlugin({
- 'process.env': env
- }),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- },
- sourceMap: true
- }),
- // extract css into its own file
- new ExtractTextPlugin({
- filename: utils.assetsPath('css/[name].[contenthash].css')
- }),
- // Compress extracted CSS. We are using this plugin so that possible
- // duplicated CSS from different components can be deduped.
- new OptimizeCSSPlugin(),
- // generate dist index.html with correct asset hash for caching.
- // you can customize output by editing /index.html
- // see https://github.com/ampedandwired/html-webpack-plugin
- new HtmlWebpackPlugin({
- filename: process.env.NODE_ENV === 'testing'
- ? 'index.html'
- : config.build.index,
- template: 'index.html',
- inject: true,
- favicon: resolveApp('favicon.ico'),
- minify: {
- removeComments: true,
- collapseWhitespace: true,
- removeRedundantAttributes: true,
- useShortDoctype: true,
- removeEmptyAttributes: true,
- removeStyleLinkTypeAttributes: true,
- keepClosingSlash: true,
- minifyJS: true,
- minifyCSS: true,
- minifyURLs: true
- },
- path:config.build.staticPath,
- // necessary to consistently work with multiple chunks via CommonsChunkPlugin
- chunksSortMode: 'dependency'
- }),
- // split vendor js into its own file
- new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor',
- minChunks: function (module, count) {
- // any required modules inside node_modules are extracted to vendor
- return (
- module.resource &&
- /\.js$/.test(module.resource) &&
- module.resource.indexOf(
- path.join(__dirname, '../node_modules')
- ) === 0
- )
- }
- }),
- // extract webpack runtime and module manifest to its own file in order to
- // prevent vendor hash from being updated whenever app bundle is updated
- new webpack.optimize.CommonsChunkPlugin({
- name: 'manifest',
- chunks: ['vendor']
- }),
- // copy custom static assets
- new CopyWebpackPlugin([
- {
- from: path.resolve(__dirname, '../static'),
- to: config.build.assetsSubDirectory,
- ignore: ['.*']
- }
- ]),
- new webpack.ProvidePlugin({
- $: 'jquery',
- 'jQuery': 'jquery'
- })
- ]
+ module: {
+ rules: utils.styleLoaders({
+ sourceMap: config.build.productionSourceMap,
+ extract: true
+ })
+ },
+ devtool: config.build.productionSourceMap ? '#source-map' : false,
+ output: {
+ path: config.build.assetsRoot,
+ filename: utils.assetsPath('js/[name].[chunkhash].js'),
+ chunkFilename: utils.assetsPath('js/[id].[chunkhash].js'),
+ publicPath: config.build.assetsPublicPath
+ },
+ plugins: [
+ // http://vuejs.github.io/vue-loader/en/workflow/production.html
+ new webpack.DefinePlugin({
+ 'process.env': env
+ }),
+ new webpack.optimize.UglifyJsPlugin({
+ compress: {
+ warnings: false
+ },
+ sourceMap: true
+ }),
+ // extract css into its own file
+ new ExtractTextPlugin({
+ filename: utils.assetsPath('css/[name].[contenthash].css')
+ }),
+ // Compress extracted CSS. We are using this plugin so that possible
+ // duplicated CSS from different components can be deduped.
+ new OptimizeCSSPlugin(),
+ // generate dist index.html with correct asset hash for caching.
+ // you can customize output by editing /index.html
+ // see https://github.com/ampedandwired/html-webpack-plugin
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ template: 'index.html',
+ inject: true,
+ favicon: resolveApp('favicon.ico'),
+ minify: {
+ removeComments: true,
+ collapseWhitespace: true,
+ removeRedundantAttributes: true,
+ useShortDoctype: true,
+ removeEmptyAttributes: true,
+ removeStyleLinkTypeAttributes: true,
+ keepClosingSlash: true,
+ minifyJS: true,
+ minifyCSS: true,
+ minifyURLs: true
+ },
+ path: config.build.assetsPublicPath + config.build.assetsSubDirectory,
+ // necessary to consistently work with multiple chunks via CommonsChunkPlugin
+ chunksSortMode: 'dependency'
+ }),
+ // cache Module Identifiers
+ new webpack.HashedModuleIdsPlugin(),
+ // split vendor js into its own file
+ new webpack.optimize.CommonsChunkPlugin({
+ name: 'vendor',
+ minChunks: function (module, count) {
+ // any required modules inside node_modules are extracted to vendor
+ return (
+ module.resource &&
+ /\.js$/.test(module.resource) &&
+ module.resource.indexOf(
+ path.join(__dirname, '../node_modules')
+ ) === 0
+ )
+ }
+ }),
+ // split echarts into its own file
+ new webpack.optimize.CommonsChunkPlugin({
+ async: 'echarts',
+ minChunks(module) {
+ var context = module.context;
+ return context && (context.indexOf('echarts') >= 0 || context.indexOf('zrender') >= 0);
+ }
+ }),
+ // extract webpack runtime and module manifest to its own file in order to
+ // prevent vendor hash from being updated whenever app bundle is updated
+ new webpack.optimize.CommonsChunkPlugin({
+ name: 'manifest',
+ chunks: ['vendor']
+ }),
+ // copy custom static assets
+ new CopyWebpackPlugin([{
+ from: path.resolve(__dirname, '../static'),
+ to: config.build.assetsSubDirectory,
+ ignore: ['.*']
+ }])
+ ]
})
if (config.build.bundleAnalyzerReport) {
- var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
- webpackConfig.plugins.push(new BundleAnalyzerPlugin())
+ var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
+ webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig
+
diff --git a/config/index.js b/config/index.js
index 9178385b..581d53a3 100644
--- a/config/index.js
+++ b/config/index.js
@@ -7,10 +7,9 @@ module.exports = {
prodEnv: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
- assetsSubDirectory: '',
- assetsPublicPath: './', //生产环境assetsPublicPath: '/'
- staticPath:'./', //生产环境 staticPath:''
- productionSourceMap: true,
+ assetsSubDirectory: 'static',
+ assetsPublicPath: './', //请根据自己路径配置更改
+ productionSourceMap: false,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
@@ -29,7 +28,6 @@ module.exports = {
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
- staticPath:'/static/',
proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
diff --git a/documentImg/code1.png b/documentImg/code1.png
deleted file mode 100644
index e29c67b9..00000000
Binary files a/documentImg/code1.png and /dev/null differ
diff --git a/documentImg/iconfont.png b/documentImg/iconfont.png
deleted file mode 100644
index a2159172..00000000
Binary files a/documentImg/iconfont.png and /dev/null differ
diff --git a/gifs/tabs.gif b/gifs/tabs.gif
new file mode 100644
index 00000000..331d192f
Binary files /dev/null and b/gifs/tabs.gif differ
diff --git a/index.html b/index.html
index 67f2ed3e..830bf1f8 100644
--- a/index.html
+++ b/index.html
@@ -8,10 +8,8 @@