From 0ae5079b2a330ceb4b14c16962256eed21335456 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Fri, 5 Jun 2020 01:32:15 -0400 Subject: [PATCH 01/21] docs: Improve read me files and changes in Spanish. (#3234) --- README.es.md | 27 +++++++++++++++------------ README.ja.md | 9 ++++++--- README.md | 9 ++++++--- README.zh-CN.md | 9 ++++++--- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/README.es.md b/README.es.md index 3e054ce9..472adb60 100644 --- a/README.es.md +++ b/README.es.md @@ -51,11 +51,11 @@ Vue Element Admin es una solución práctica basada en la nueva plataforma de de - Plantilla de Typescript: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Créditos: [@Armour](https://github.com/Armour)) - [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312) -**Después de la versión `v4.1.0+`, la rama por defecto master no tendrá soporte para i18n. Por favor use [i18n](https://github.com/PanJiaChen/vue-element-admin/tree/i18n), los cambios serán incluidos en la rama master** +**Después de la versión `v4.1.0+`, la rama por defecto master no tendrá soporte para i18n. Por favor utilice la rama [i18n](https://github.com/PanJiaChen/vue-element-admin/tree/i18n), los cambios serán incluidos en la rama master** **la versión actual es `v4.0+` construida con `vue-cli`. Si encuentra algún problema, por favor coloque un [issue](https://github.com/PanJiaChen/vue-element-admin/issues/new). Si desea usar la versión anterior, puede cambiar de rama a [tag/3.11.0](https://github.com/PanJiaChen/vue-element-admin/tree/tag/3.11.0), no relacionado con `vue-cli`** -**Este proyecto no está soportado para versiones muy viejas de navegadores (e.g. IE).** +**Este proyecto no está soportado para versiones antigüas de navegadores (ej. IE).** ## Preparación @@ -64,13 +64,13 @@ Entendiendo y aprendiendo esto pudiera ayudarle con su proyecto. [![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/PanJiaChen/vue-element-admin/tree/CodeSandbox) -

+

## Patrocinantes -Se un patrocinante y pon tu logo en nuestro README on GitHub con un enlace directo a tu sitio web. [[Se un Patrocinante]](https://www.patreon.com/panjiachen) +Sea un patrocinante y coloque su logo en nuestro LEEME en GitHub con un enlace directo a su sitio web. [[Se un Patrocinante]](https://www.patreon.com/panjiachen)

Plantilla de Dashboard de administración hecha con Vue, React y Angular.

@@ -79,25 +79,28 @@ Se un patrocinante y pon tu logo en nuestro README on GitHub con un enlace direc ``` - Iniciar / Cerrar Sesión -- Permisos de Authentication +- Permisos de Autenticación - Página de Permisos - Directivas de permisos - Página de configuración de permisos - Autenticación por dos pasos - Construcción Multi-entorno - - dev sit stage producción + - Desarrollo (dev) + - sit + - Escenario de pruebas (stage), + - Producción (prod) - Características Globales - I18n - Temas dinámicos - - Dynamic sidebar (soporte a rutas multi-nivel) + - Menu lateral dinámico (soporte a rutas multi-nivel) - Barra de rutas dinámica - - Tags-view (Tab page Support right-click operation) + - Tags-view (Pestañas de página, Soporta operación de clic derecho) - Svg Sprite - Datos de simulación con Mock - Pantalla completa - - Responsive Sidebar + - Menu lateral responsivo - Editor - Editor de Texto Enriquecido @@ -108,7 +111,7 @@ Se un patrocinante y pon tu logo en nuestro README on GitHub con un enlace direc - Exportación a Excel - Carga de Excel - Visualización de Excel - - Exportación como zip + - Exportación como ZIP - Tabla - Tabla Dinámica @@ -137,7 +140,7 @@ Se un patrocinante y pon tu logo en nuestro README on GitHub con un enlace direc - Página de Guías - ECharts (Gráficos) - Portapapeles -- Convertidor de Markdown a html +- Convertidor de Markdown a HTML ``` ## Iniciando @@ -210,7 +213,7 @@ Navegadores modernos e Internet Explorer 10+. | [IE / Edge](https://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](https://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](https://godban.github.io/browsers-support-badges/)
Chrome | [Safari](https://godban.github.io/browsers-support-badges/)
Safari | | --------- | --------- | --------- | --------- | -| IE10, IE11, Edge| últimas 2 versiones| últimas 2 versiones| últimas 2 versiones +| IE10, IE11, Edge | últimas 2 versiones | últimas 2 versiones | últimas 2 versiones | ## Licencia diff --git a/README.ja.md b/README.ja.md index a20a4d71..28ed674c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -61,7 +61,7 @@ [![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/PanJiaChen/vue-element-admin/tree/CodeSandbox) -

+

@@ -83,7 +83,10 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s - 外部IDでログイン - 複数環境デプロイ - - dev sit stage prod + - dev + - sit + - stage + - prod - 共通機能 - 多言語切替 @@ -206,7 +209,7 @@ Modern browsers and Internet Explorer 10+. | [IE / Edge](https://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](https://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](https://godban.github.io/browsers-support-badges/)
Chrome | [Safari](https://godban.github.io/browsers-support-badges/)
Safari | | --------- | --------- | --------- | --------- | -| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions +| IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | ## License diff --git a/README.md b/README.md index 458ae970..5067b8d3 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Understanding and learning this knowledge in advance will greatly help the use o [![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/PanJiaChen/vue-element-admin/tree/CodeSandbox) -

+

@@ -86,7 +86,10 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s - Two-step login - Multi-environment build - - dev sit stage prod + - Develop (dev) + - sit + - Stage Test (stage) + - Production (prod) - Global Features - I18n @@ -210,7 +213,7 @@ Modern browsers and Internet Explorer 10+. | [IE / Edge](https://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](https://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](https://godban.github.io/browsers-support-badges/)
Chrome | [Safari](https://godban.github.io/browsers-support-badges/)
Safari | | --------- | --------- | --------- | --------- | -| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions +| IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | ## License diff --git a/README.zh-CN.md b/README.zh-CN.md index e8424111..d429b91e 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -79,7 +79,7 @@ [![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/PanJiaChen/vue-element-admin/tree/CodeSandbox) -

+

@@ -101,7 +101,10 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s - 二步登录 - 多环境发布 - - dev sit stage prod + - dev + - sit + - stage + - prod - 全局功能 - 国际化多语言 @@ -233,7 +236,7 @@ Modern browsers and Internet Explorer 10+. | [IE / Edge](https://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](https://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](https://godban.github.io/browsers-support-badges/)
Chrome | [Safari](https://godban.github.io/browsers-support-badges/)
Safari | | --------- | --------- | --------- | --------- | -| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions +| IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | ## License From f1feb2a86d35b7e78ee6db18bd99c584e0a4cad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 8 Jun 2020 19:38:55 +0800 Subject: [PATCH 02/21] [release] 4.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 448d1ec3..f191198b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "4.2.1", + "version": "4.2.2", "description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", "license": "MIT", From 534cd5bc269261408d74c6bb743cec8b20dfd8cd Mon Sep 17 00:00:00 2001 From: Cat73 Date: Mon, 8 Jun 2020 20:41:46 +0800 Subject: [PATCH 03/21] chore: change node-sass to dart-sass (#3040) --- package.json | 2 +- src/components/HeaderSearch/index.vue | 2 +- src/components/Tinymce/components/EditorImage.vue | 2 +- src/layout/components/TagsView/ScrollPane.vue | 2 +- src/views/dashboard/admin/components/BoxCard.vue | 2 +- src/views/example/components/ArticleDetail.vue | 2 +- src/views/permission/directive.vue | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index f191198b..ec2eb417 100644 --- a/package.json +++ b/package.json @@ -92,9 +92,9 @@ "husky": "1.3.1", "lint-staged": "8.1.5", "mockjs": "1.0.1-beta3", - "node-sass": "^4.9.0", "plop": "2.3.0", "runjs": "^4.3.2", + "sass": "^1.26.2", "sass-loader": "^7.1.0", "script-ext-html-webpack-plugin": "2.1.3", "serve-static": "^1.13.2", diff --git a/src/components/HeaderSearch/index.vue b/src/components/HeaderSearch/index.vue index af047168..6026ebb4 100644 --- a/src/components/HeaderSearch/index.vue +++ b/src/components/HeaderSearch/index.vue @@ -159,7 +159,7 @@ export default { display: inline-block; vertical-align: middle; - /deep/ .el-input__inner { + ::v-deep .el-input__inner { border-radius: 0; border: 0; padding-left: 0; diff --git a/src/components/Tinymce/components/EditorImage.vue b/src/components/Tinymce/components/EditorImage.vue index d4a98e84..07d48e6c 100644 --- a/src/components/Tinymce/components/EditorImage.vue +++ b/src/components/Tinymce/components/EditorImage.vue @@ -104,7 +104,7 @@ export default { diff --git a/src/components/JsonEditor/index.vue b/src/components/JsonEditor/index.vue index 07b282e4..c05b090c 100644 --- a/src/components/JsonEditor/index.vue +++ b/src/components/JsonEditor/index.vue @@ -54,19 +54,24 @@ export default { } - diff --git a/src/components/Tinymce/index.vue b/src/components/Tinymce/index.vue index b3538c25..0cd4e9cd 100644 --- a/src/components/Tinymce/index.vue +++ b/src/components/Tinymce/index.vue @@ -213,28 +213,37 @@ export default { } - diff --git a/src/router/index.js b/src/router/index.js index 2e522b2a..9c05f896 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -25,7 +25,7 @@ import nestedRouter from './modules/nested' * meta : { roles: ['admin','editor'] control the page roles (you can set multiple roles) title: 'title' the name show in sidebar and breadcrumb (recommend set) - icon: 'svg-name' the icon show in the sidebar + icon: 'svg-name'/'el-icon-x' the icon show in the sidebar noCache: true if set true, the page will no be cached(default is false) affix: true if set true, the tag will affix in the tags-view breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) @@ -197,14 +197,14 @@ export const asyncRoutes = [ name: 'Example', meta: { title: 'Example', - icon: 'example' + icon: 'el-icon-s-help' }, children: [ { path: 'create', component: () => import('@/views/example/create'), name: 'CreateArticle', - meta: { title: 'Create Article', icon: 'edit' } + meta: { title: 'Create Article', icon: 'el-icon-s-help' } }, { path: 'edit/:id(\\d+)', diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index 3dad4c39..94760cc7 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -57,6 +57,11 @@ margin-right: 16px; } + .sub-el-icon { + margin-right: 12px; + margin-left: -2px; + } + .el-menu { border: none; height: 100%; @@ -105,6 +110,10 @@ .svg-icon { margin-left: 20px; } + + .sub-el-icon { + margin-left: 19px; + } } } @@ -118,6 +127,10 @@ margin-left: 20px; } + .sub-el-icon { + margin-left: 19px; + } + .el-submenu__icon-arrow { display: none; } @@ -178,6 +191,10 @@ .svg-icon { margin-right: 16px; } + .sub-el-icon { + margin-right: 12px; + margin-left: -2px; + } } .nest-menu .el-submenu>.el-submenu__title, From a50180f6538aba51074f0152157075337e73a4fd Mon Sep 17 00:00:00 2001 From: MaYuanhai <414199639@qq.com> Date: Thu, 11 Jun 2020 20:18:23 +0800 Subject: [PATCH 10/21] fix[utils]: param2Obj bug when url params includes ==(#3100) --- src/utils/index.js | 28 +++++++++++++++------------- tests/unit/utils/param2Obj.spec.js | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 tests/unit/utils/param2Obj.spec.js diff --git a/src/utils/index.js b/src/utils/index.js index 96ee6e7f..50da2621 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -162,19 +162,21 @@ export function param(json) { * @returns {Object} */ export function param2Obj(url) { - const search = url.split('?')[1] - if (!search) { - return {} - } - return JSON.parse( - '{"' + - decodeURIComponent(search) - .replace(/"/g, '\\"') - .replace(/&/g, '","') - .replace(/=/g, '":"') - .replace(/\+/g, ' ') + - '"}' - ) + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') + if (!search) { + return {} + } + const obj = {} + const searchArr = search.split('&') + searchArr.forEach(v => { + const index = v.indexOf('=') + if (index !== -1) { + const name = v.substring(0, index) + const val = v.substring(index + 1, v.length) + obj[name] = val + } + }) + return obj } /** diff --git a/tests/unit/utils/param2Obj.spec.js b/tests/unit/utils/param2Obj.spec.js new file mode 100644 index 00000000..e106ed88 --- /dev/null +++ b/tests/unit/utils/param2Obj.spec.js @@ -0,0 +1,14 @@ +import { param2Obj } from '@/utils/index.js' +describe('Utils:param2Obj', () => { + const url = 'https://github.com/PanJiaChen/vue-element-admin?name=bill&age=29&sex=1&field=dGVzdA==&key=%E6%B5%8B%E8%AF%95' + + it('param2Obj test', () => { + expect(param2Obj(url)).toEqual({ + name: 'bill', + age: '29', + sex: '1', + field: window.btoa('test'), + key: '测试' + }) + }) +}) From 7702b3d809a312feb2a9eb7c7a70fef3ea0628b8 Mon Sep 17 00:00:00 2001 From: Silentdoer <1010993610@qq.com> Date: Thu, 11 Jun 2020 20:24:17 +0800 Subject: [PATCH 11/21] perf: remove unused showdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 花裤衩 --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index cded3a4f..482d5a48 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "path-to-regexp": "2.4.0", "screenfull": "4.2.0", "script-loader": "0.7.2", - "showdown": "1.9.0", "sortablejs": "1.8.4", "tui-editor": "1.3.3", "vue": "2.6.10", From a87218e2663210be30171b92b29e5ea894f12085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 11 Jun 2020 20:51:10 +0800 Subject: [PATCH 12/21] perf: lint code --- src/utils/index.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 50da2621..3225d3c4 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -162,21 +162,21 @@ export function param(json) { * @returns {Object} */ export function param2Obj(url) { - const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') - if (!search) { - return {} + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') + if (!search) { + return {} + } + const obj = {} + const searchArr = search.split('&') + searchArr.forEach(v => { + const index = v.indexOf('=') + if (index !== -1) { + const name = v.substring(0, index) + const val = v.substring(index + 1, v.length) + obj[name] = val } - const obj = {} - const searchArr = search.split('&') - searchArr.forEach(v => { - const index = v.indexOf('=') - if (index !== -1) { - const name = v.substring(0, index) - const val = v.substring(index + 1, v.length) - obj[name] = val - } - }) - return obj + }) + return obj } /** From 4e7665c07226cf3bc3278a9af1bf60fe6782cb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 11 Jun 2020 21:02:18 +0800 Subject: [PATCH 13/21] fix[v-permission]: support dynamic set roles (#3251) --- src/directive/permission/permission.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/directive/permission/permission.js b/src/directive/permission/permission.js index b27f24da..49d1f889 100644 --- a/src/directive/permission/permission.js +++ b/src/directive/permission/permission.js @@ -1,11 +1,11 @@ import store from '@/store' -export default { - inserted(el, binding, vnode) { - const { value } = binding - const roles = store.getters && store.getters.roles +function checkPermission(el, binding) { + const { value } = binding + const roles = store.getters && store.getters.roles - if (value && value instanceof Array && value.length > 0) { + if (value && value instanceof Array) { + if (value.length > 0) { const permissionRoles = value const hasPermission = roles.some(role => { @@ -15,8 +15,17 @@ export default { if (!hasPermission) { el.parentNode && el.parentNode.removeChild(el) } - } else { - throw new Error(`need roles! Like v-permission="['admin','editor']"`) } + } else { + throw new Error(`need roles! Like v-permission="['admin','editor']"`) + } +} + +export default { + inserted(el, binding) { + checkPermission(el, binding) + }, + update(el, binding) { + checkPermission(el, binding) } } From 1c943509f9788297f0ddc188208f9501648c8e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Fri, 12 Jun 2020 10:18:05 +0800 Subject: [PATCH 14/21] chore: update element-ui to 2.13.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 482d5a48..7f8e8d31 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "driver.js": "0.9.5", "dropzone": "5.5.1", "echarts": "4.2.1", - "element-ui": "2.13.0", + "element-ui": "2.13.2", "file-saver": "2.0.1", "fuse.js": "3.4.4", "js-cookie": "2.2.0", From 6d88db5c73ea54063190830da3d1a40421c51bf3 Mon Sep 17 00:00:00 2001 From: qige2016 <286882998@qq.com> Date: Mon, 15 Jun 2020 12:00:17 +0800 Subject: [PATCH 15/21] fix[plop]: set trim => trim() (#3254) notEmpty --- plop-templates/utils.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/plop-templates/utils.js b/plop-templates/utils.js index 0310ca02..04987539 100644 --- a/plop-templates/utils.js +++ b/plop-templates/utils.js @@ -1,9 +1,2 @@ -exports.notEmpty = name => { - return v => { - if (!v || v.trim === '') { - return `${name} is required` - } else { - return true - } - } -} +exports.notEmpty = name => v => + !v || v.trim() === '' ? `${name} is required` : true From 435db380d3d26a902d6c03092f1aeb2d316b26b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 15 Jun 2020 17:18:55 +0800 Subject: [PATCH 16/21] fix some typos --- mock/utils.js | 22 ++++++++++++---------- src/router/index.js | 2 +- vue.config.js | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mock/utils.js b/mock/utils.js index 5bd2d2c9..f909a293 100644 --- a/mock/utils.js +++ b/mock/utils.js @@ -3,19 +3,21 @@ * @returns {Object} */ function param2Obj(url) { - const search = url.split('?')[1] + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') if (!search) { return {} } - return JSON.parse( - '{"' + - decodeURIComponent(search) - .replace(/"/g, '\\"') - .replace(/&/g, '","') - .replace(/=/g, '":"') - .replace(/\+/g, ' ') + - '"}' - ) + const obj = {} + const searchArr = search.split('&') + searchArr.forEach(v => { + const index = v.indexOf('=') + if (index !== -1) { + const name = v.substring(0, index) + const val = v.substring(index + 1, v.length) + obj[name] = val + } + }) + return obj } /** diff --git a/src/router/index.js b/src/router/index.js index 9c05f896..2be959d2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -204,7 +204,7 @@ export const asyncRoutes = [ path: 'create', component: () => import('@/views/example/create'), name: 'CreateArticle', - meta: { title: 'Create Article', icon: 'el-icon-s-help' } + meta: { title: 'Create Article', icon: 'edit' } }, { path: 'edit/:id(\\d+)', diff --git a/vue.config.js b/vue.config.js index aabbf651..6733dd50 100644 --- a/vue.config.js +++ b/vue.config.js @@ -53,7 +53,7 @@ module.exports = { // config.plugins.delete('preload') // when there are many pages, it will cause too many meaningless requests - config.plugins.delete('prefetch') // + config.plugins.delete('prefetch') // set svg-sprite-loader config.module From f6d8204b0b6fbb794ada0c99391b7b85ce976380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 18 Jun 2020 21:01:02 +0800 Subject: [PATCH 17/21] [release] 4.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f8e8d31..5f4ee58c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "4.3.0", + "version": "4.3.1", "description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", "license": "MIT", From ae2aa61880ff2bb1edde0059d87eddebdba18f3c Mon Sep 17 00:00:00 2001 From: Dihak Date: Sun, 21 Jun 2020 20:25:55 +0700 Subject: [PATCH 18/21] bump: update to vue-cli@4 (#3028) --- .env.development | 9 --- babel.config.js | 13 +++- package.json | 99 ++++++++++++++------------- src/components/ImageCropper/index.vue | 1 + src/store/modules/settings.js | 1 + src/store/modules/user.js | 29 ++++---- src/views/excel/merge-header.vue | 28 ++++---- 7 files changed, 89 insertions(+), 91 deletions(-) diff --git a/.env.development b/.env.development index 8f5856db..de583d09 100644 --- a/.env.development +++ b/.env.development @@ -3,12 +3,3 @@ ENV = 'development' # base api VUE_APP_BASE_API = '/dev-api' - -# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, -# to control whether the babel-plugin-dynamic-import-node plugin is enabled. -# It only does one thing by converting all import() to require(). -# This configuration can significantly increase the speed of hot updates, -# when you have a large number of pages. -# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js - -VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/babel.config.js b/babel.config.js index ba179669..fb82b271 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,14 @@ module.exports = { presets: [ - '@vue/app' - ] + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app + '@vue/cli-plugin-babel/preset' + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html + 'plugins': ['dynamic-import-node'] + } + } } diff --git a/package.json b/package.json index 5f4ee58c..e99735ba 100644 --- a/package.json +++ b/package.json @@ -3,49 +3,22 @@ "version": "4.3.1", "description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", - "license": "MIT", "scripts": { "dev": "vue-cli-service serve", + "lint": "eslint --ext .js,.vue src", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", - "lint": "eslint --ext .js,.vue src", - "test:unit": "jest --clearCache && vue-cli-service test:unit", - "test:ci": "npm run lint && npm run test:unit", + "new": "plop", "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", - "new": "plop" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "src/**/*.{js,vue}": [ - "eslint --fix", - "git add" - ] - }, - "keywords": [ - "vue", - "admin", - "dashboard", - "element-ui", - "boilerplate", - "admin-template", - "management-system" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/PanJiaChen/vue-element-admin.git" - }, - "bugs": { - "url": "https://github.com/PanJiaChen/vue-element-admin/issues" + "test:unit": "jest --clearCache && vue-cli-service test:unit", + "test:ci": "npm run lint && npm run test:unit" }, "dependencies": { "axios": "0.18.1", "clipboard": "2.0.4", "codemirror": "5.45.0", + "core-js": "3.6.5", "driver.js": "0.9.5", "dropzone": "5.5.1", "echarts": "4.2.1", @@ -71,40 +44,68 @@ "xlsx": "0.14.1" }, "devDependencies": { - "@vue/cli-plugin-babel": "3.5.3", - "@vue/cli-plugin-eslint": "^3.9.1", - "@vue/cli-plugin-unit-jest": "3.5.3", - "@vue/cli-service": "3.5.3", + "@vue/cli-plugin-babel": "4.4.4", + "@vue/cli-plugin-eslint": "4.4.4", + "@vue/cli-plugin-unit-jest": "4.4.4", + "@vue/cli-service": "4.4.4", "@vue/test-utils": "1.0.0-beta.29", - "autoprefixer": "^9.5.1", - "babel-core": "7.0.0-bridge.0", - "babel-eslint": "10.0.1", + "autoprefixer": "9.5.1", + "babel-eslint": "10.1.0", "babel-jest": "23.6.0", + "babel-plugin-dynamic-import-node": "2.3.3", "chalk": "2.4.2", "chokidar": "2.1.5", "connect": "3.6.6", - "eslint": "5.15.3", - "eslint-plugin-vue": "5.2.2", + "eslint": "6.7.2", + "eslint-plugin-vue": "6.2.2", "html-webpack-plugin": "3.2.0", "husky": "1.3.1", "lint-staged": "8.1.5", "mockjs": "1.0.1-beta3", "plop": "2.3.0", - "runjs": "^4.3.2", - "sass": "^1.26.2", - "sass-loader": "^7.1.0", + "runjs": "4.3.2", + "sass": "1.26.2", + "sass-loader": "8.0.2", "script-ext-html-webpack-plugin": "2.1.3", - "serve-static": "^1.13.2", + "serve-static": "1.13.2", "svg-sprite-loader": "4.1.3", "svgo": "1.2.0", "vue-template-compiler": "2.6.10" }, + "browserslist": [ + "> 1%", + "last 2 versions" + ], + "bugs": { + "url": "https://github.com/PanJiaChen/vue-element-admin/issues" + }, "engines": { "node": ">=8.9", "npm": ">= 3.0.0" }, - "browserslist": [ - "> 1%", - "last 2 versions" - ] + "keywords": [ + "vue", + "admin", + "dashboard", + "element-ui", + "boilerplate", + "admin-template", + "management-system" + ], + "license": "MIT", + "lint-staged": { + "src/**/*.{js,vue}": [ + "eslint --fix", + "git add" + ] + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/PanJiaChen/vue-element-admin.git" + } } diff --git a/src/components/ImageCropper/index.vue b/src/components/ImageCropper/index.vue index 13ae9a11..65a4262b 100644 --- a/src/components/ImageCropper/index.vue +++ b/src/components/ImageCropper/index.vue @@ -248,6 +248,7 @@ export default { // 浏览器是否支持该控件 isSupported, // 浏览器是否支持触屏事件 + // eslint-disable-next-line no-prototype-builtins isSupportTouch: document.hasOwnProperty('ontouchstart'), // 步骤 step: 1, // 1选择文件 2剪裁 3上传 diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index e389af79..110533f7 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -13,6 +13,7 @@ const state = { const mutations = { CHANGE_SETTING: (state, { key, value }) => { + // eslint-disable-next-line no-prototype-builtins if (state.hasOwnProperty(key)) { state[key] = value } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 1391fa4a..78009412 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -103,28 +103,23 @@ const actions = { }, // dynamically modify permissions - changeRoles({ commit, dispatch }, role) { - return new Promise(async resolve => { - const token = role + '-token' + async changeRoles({ commit, dispatch }, role) { + const token = role + '-token' - commit('SET_TOKEN', token) - setToken(token) + commit('SET_TOKEN', token) + setToken(token) - const { roles } = await dispatch('getInfo') + const { roles } = await dispatch('getInfo') - resetRouter() + resetRouter() - // generate accessible routes map based on roles - const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true }) + // generate accessible routes map based on roles + const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true }) + // dynamically add accessible routes + router.addRoutes(accessRoutes) - // dynamically add accessible routes - router.addRoutes(accessRoutes) - - // reset visited views and cached views - dispatch('tagsView/delAllViews', null, { root: true }) - - resolve() - }) + // reset visited views and cached views + dispatch('tagsView/delAllViews', null, { root: true }) } } diff --git a/src/views/excel/merge-header.vue b/src/views/excel/merge-header.vue index 2646b9d0..4be0227d 100644 --- a/src/views/excel/merge-header.vue +++ b/src/views/excel/merge-header.vue @@ -71,21 +71,21 @@ export default { }, handleDownload() { this.downloadLoading = true - import('@/vendor/Export2Excel').then(excel => { - const multiHeader = [['Id', 'Main Information', '', '', 'Date']] - const header = ['', 'Title', 'Author', 'Readings', ''] - const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'] - const list = this.list - const data = this.formatJson(filterVal, list) - const merges = ['A1:A2', 'B1:D1', 'E1:E2'] - excel.export_json_to_excel({ - multiHeader, - header, - merges, - data - }) - this.downloadLoading = false + import('@/vendor/Export2Excel').then(excel => { + const multiHeader = [['Id', 'Main Information', '', '', 'Date']] + const header = ['', 'Title', 'Author', 'Readings', ''] + const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'] + const list = this.list + const data = this.formatJson(filterVal, list) + const merges = ['A1:A2', 'B1:D1', 'E1:E2'] + excel.export_json_to_excel({ + multiHeader, + header, + merges, + data }) + this.downloadLoading = false + }) }, formatJson(filterVal, jsonData) { return jsonData.map(v => filterVal.map(j => { From 585391228ecf9150247cf755510eb741a7fe18dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Sun, 21 Jun 2020 21:39:37 +0800 Subject: [PATCH 19/21] [release] 4.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e99735ba..02f68e23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "4.3.1", + "version": "4.4.0", "description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", "scripts": { From 73a9ab03797dcc6ad91e2150280401857957884f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Tue, 23 Jun 2020 21:12:44 +0800 Subject: [PATCH 20/21] fix[chore]: do not preload runtime.js (#3279) --- vue.config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vue.config.js b/vue.config.js index 6733dd50..68b3e99e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -50,7 +50,16 @@ module.exports = { }, chainWebpack(config) { // it can improve the speed of the first screen, it is recommended to turn on preload - // config.plugins.delete('preload') + // it can improve the speed of the first screen, it is recommended to turn on preload + config.plugin('preload').tap(() => [ + { + rel: 'preload', + // to ignore runtime.js + // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171 + fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], + include: 'initial' + } + ]) // when there are many pages, it will cause too many meaningless requests config.plugins.delete('prefetch') @@ -118,6 +127,7 @@ module.exports = { } } }) + // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk config.optimization.runtimeChunk('single') } ) From 7c062141906bfff672232b1a42b35a42db8a43c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Wed, 24 Jun 2020 10:17:57 +0800 Subject: [PATCH 21/21] perf[chore]: remove preserveWhitespace config (#3280) --- vue.config.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/vue.config.js b/vue.config.js index 68b3e99e..33a63483 100644 --- a/vue.config.js +++ b/vue.config.js @@ -81,17 +81,6 @@ module.exports = { }) .end() - // set preserveWhitespace - config.module - .rule('vue') - .use('vue-loader') - .loader('vue-loader') - .tap(options => { - options.compilerOptions.preserveWhitespace = true - return options - }) - .end() - config .when(process.env.NODE_ENV !== 'development', config => {