From 1701fcce5d8f43d96ca61109d2b08d4d106b18d5 Mon Sep 17 00:00:00 2001 From: LarchLiu Date: Fri, 2 Nov 2018 15:07:39 +0800 Subject: [PATCH 01/75] fix[Charts]: fixed charts resize mixins bug #1285 (#1290) --- src/components/Charts/mixins/resize.js | 12 ++++++++---- src/views/dashboard/admin/components/LineChart.vue | 10 +++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/Charts/mixins/resize.js b/src/components/Charts/mixins/resize.js index dc61f859..c4c432f4 100644 --- a/src/components/Charts/mixins/resize.js +++ b/src/components/Charts/mixins/resize.js @@ -1,6 +1,11 @@ import { debounce } from '@/utils' export default { + data() { + return { + sidebarElm: null + } + }, mounted() { this.__resizeHandler = debounce(() => { if (this.chart) { @@ -9,14 +14,13 @@ export default { }, 100) window.addEventListener('resize', this.__resizeHandler) - const sidebarElm = document.getElementsByClassName('sidebar-container')[0] - sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler) + this.sidebarElm = document.getElementsByClassName('sidebar-container')[0] + this.sidebarElm && this.sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler) }, beforeDestroy() { window.removeEventListener('resize', this.__resizeHandler) - const sidebarElm = document.getElementsByClassName('sidebar-container')[0] - sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler) + this.sidebarElm && this.sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler) }, methods: { sidebarResizeHandler(e) { diff --git a/src/views/dashboard/admin/components/LineChart.vue b/src/views/dashboard/admin/components/LineChart.vue index ef493c4b..dfd121e5 100644 --- a/src/views/dashboard/admin/components/LineChart.vue +++ b/src/views/dashboard/admin/components/LineChart.vue @@ -32,7 +32,8 @@ export default { }, data() { return { - chart: null + chart: null, + sidebarElm: null } }, watch: { @@ -55,8 +56,8 @@ export default { } // 监听侧边栏的变化 - const sidebarElm = document.getElementsByClassName('sidebar-container')[0] - sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler) + this.sidebarElm = document.getElementsByClassName('sidebar-container')[0] + this.sidebarElm && this.sidebarElm.addEventListener('transitionend', this.sidebarResizeHandler) }, beforeDestroy() { if (!this.chart) { @@ -66,8 +67,7 @@ export default { window.removeEventListener('resize', this.__resizeHandler) } - const sidebarElm = document.getElementsByClassName('sidebar-container')[0] - sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler) + this.sidebarElm && this.sidebarElm.removeEventListener('transitionend', this.sidebarResizeHandler) this.chart.dispose() this.chart = null From a25c63a580e177867d181ae678bd58837bf16c39 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 2 Nov 2018 15:10:15 +0800 Subject: [PATCH 02/75] perf[Tinymce]: add searchreplace plugin --- src/components/Tinymce/toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Tinymce/toolbar.js b/src/components/Tinymce/toolbar.js index 7d6c2c73..4f8a5450 100644 --- a/src/components/Tinymce/toolbar.js +++ b/src/components/Tinymce/toolbar.js @@ -1,6 +1,6 @@ // Here is a list of the toolbar // Detail list see https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols -const toolbar = ['bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen'] +const toolbar = ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen'] export default toolbar From 9f1552d98fb85e1e999066c43beb6d970e6b422d Mon Sep 17 00:00:00 2001 From: jaysunxiao <34591889+jaysunxiao@users.noreply.github.com> Date: Tue, 6 Nov 2018 16:11:47 +0800 Subject: [PATCH 03/75] perf[avatar]:minimize the selected area of avatar on the mobile phone when user clicked avatar (#1304) --- src/views/layout/components/Navbar.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 7bae38e0..208186e3 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -130,15 +130,16 @@ export default { height: 50px; margin-right: 30px; .avatar-wrapper { - cursor: pointer; margin-top: 5px; position: relative; .user-avatar { + cursor: pointer; width: 40px; height: 40px; border-radius: 10px; } .el-icon-caret-bottom { + cursor: pointer; position: absolute; right: -20px; top: 25px; From a0862ca54724d5729de1c67d4df15e87b721bb8a Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 8 Nov 2018 17:19:12 +0800 Subject: [PATCH 04/75] fix[DragSelect]: fixed querySelectorAll bug --- src/components/DragSelect/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DragSelect/index.vue b/src/components/DragSelect/index.vue index a08d400a..28830259 100644 --- a/src/components/DragSelect/index.vue +++ b/src/components/DragSelect/index.vue @@ -1,5 +1,5 @@ @@ -30,7 +30,7 @@ export default { }, methods: { setSort() { - const el = document.querySelectorAll('.el-select__tags > span')[0] + const el = this.$refs.dragSelect.$el.querySelectorAll('.el-select__tags > span')[0] this.sortable = Sortable.create(el, { ghostClass: 'sortable-ghost', // Class name for the drop placeholder, setData: function(dataTransfer) { From 4a7b50ed464efe716ab05950b9d630aa106d82ce Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 8 Nov 2018 17:30:17 +0800 Subject: [PATCH 05/75] perf[DragSelect]: add $listeners --- src/components/DragSelect/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DragSelect/index.vue b/src/components/DragSelect/index.vue index 28830259..513be006 100644 --- a/src/components/DragSelect/index.vue +++ b/src/components/DragSelect/index.vue @@ -1,5 +1,5 @@ From 9df740bcf1a55c7cfc90a1744c39fe4a1d231a14 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 9 Nov 2018 09:51:29 +0800 Subject: [PATCH 06/75] fix link --- src/components/TreeTable/readme.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/TreeTable/readme.md b/src/components/TreeTable/readme.md index 2a3b5af8..5b598e11 100644 --- a/src/components/TreeTable/readme.md +++ b/src/components/TreeTable/readme.md @@ -41,9 +41,9 @@ 1. text: 显示在表头的文字 2. value: 对应data的key。treeTable将显示相应的value 3. width: 每列的宽度,为一个数字(可选) - + 如果你想要每个字段都有自定义的样式或者嵌套其他组件,columns可不提供,直接像在el-table一样写即可,如果没有自定义内容,提供columns将更加的便捷方便 - + 如果你有几个字段是需要自定义的,几个不需要,那么可以将不需要自定义的字段放入columns,将需要自定义的内容放入到slot中,详情见后文 ```javascript [{ @@ -65,7 +65,7 @@ 如果不提供,将使用默认的[evalFunc](./eval.js) - 如果提供了evalFunc,那么会用提供的evalFunc去解析data,并返回treeTable渲染所需要的值。如何编写一个evalFunc,请参考[*eval.js*](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/components/TreeTable/eval.js)或[*customEval.js*](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/example/table/treeTable/customEval.js) + 如果提供了evalFunc,那么会用提供的evalFunc去解析data,并返回treeTable渲染所需要的值。如何编写一个evalFunc,请参考[*eval.js*](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/components/TreeTable/eval.js)或[*customEval.js*](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/table/treeTable/customEval.js) #### evalArgs 解析函数的参数,是一个数组 @@ -73,16 +73,16 @@ **请注意,自定义的解析函数参数第一个为this.data,第二个参数为, this.expandAll,你不需要在evalArgs填写。一定记住,这两个参数是强制性的,并且位置不可颠倒** *this.data为需要解析的数据,this.expandAll为是否默认展开* 如你的解析函数需要的参数为`(this.data, this.expandAll,1,2,3,4)`,那么你只需要将`[1,2,3,4]`赋值给`evalArgs`就可以了 - + 如果你的解析函数参数只有`(this.data, this.expandAll)`,那么就可以不用填写evalArgs了 - - 具体可参考[*customEval.js*](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/example/table/treeTable/customEval.js)的函数参数和[customTreeTable](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/example/table/treeTable/customTreeTable.vue)的`evalArgs`属性值 + + 具体可参考[*customEval.js*](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/table/treeTable/customEval.js)的函数参数和[customTreeTable](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/table/treeTable/customTreeTable.vue)的`evalArgs`属性值 ## slot 这是一个自定义列的插槽。 - - 默认情况下,treeTable只有一行行展示数据的功能。但是一般情况下,我们会要给行加上一个操作按钮或者根据当行数据展示不同的样式,这时我们就需要自定义列了。请参考[customTreeTable](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/example/table/treeTable/customTreeTable.vue),[实例效果](http://panjiachen.github.io/vue-element-admin/#/example/table/custom-tree-table) - + + 默认情况下,treeTable只有一行行展示数据的功能。但是一般情况下,我们会要给行加上一个操作按钮或者根据当行数据展示不同的样式,这时我们就需要自定义列了。请参考[customTreeTable](https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/table/treeTable/customTreeTable.vue),[实例效果](https://panjiachen.github.io/vue-element-admin/#/table/tree-table) + `slot`和`columns属性`可同时存在,columns里面的数据列会在slot自定义列的左边展示 ## 其他 From c13b5747940feb74dcf7888b6c4aeada24e5f1cc Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 9 Nov 2018 13:37:23 +0800 Subject: [PATCH 07/75] fix[Breadcurmb]: fixed pathCompile bug --- src/components/Breadcrumb/index.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 32a8fb69..70ecbf1b 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -3,7 +3,7 @@ {{ generateTitle(item.meta.title) }} - {{ generateTitle(item.meta.title) }} + {{ generateTitle(item.meta.title) }} @@ -30,12 +30,8 @@ export default { methods: { generateTitle, getBreadcrumb() { - const { params } = this.$route let matched = this.$route.matched.filter(item => { if (item.name) { - // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 - var toPath = pathToRegexp.compile(item.path) - item.path = toPath(params) return true } }) @@ -44,6 +40,12 @@ export default { matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched) } this.levelList = matched + }, + pathCompile(path) { + // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 + const { params } = this.$route + var toPath = pathToRegexp.compile(path) + return toPath(params) } } } From a51d72f42e27773a1f55beade504b79b3b8a5b46 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 9 Nov 2018 17:59:34 +0800 Subject: [PATCH 08/75] fix[Breadcurmb]: fixed router-link bug --- src/components/Breadcrumb/index.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 70ecbf1b..554abe8d 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -3,7 +3,7 @@ {{ generateTitle(item.meta.title) }} - {{ generateTitle(item.meta.title) }} + {{ generateTitle(item.meta.title) }} @@ -46,6 +46,14 @@ export default { const { params } = this.$route var toPath = pathToRegexp.compile(path) return toPath(params) + }, + handleLink(item) { + const { redirect, path } = item + if (redirect) { + this.$router.push(redirect) + return + } + this.$router.push(this.pathCompile(path)) } } } From 4a07432468a402572fc226b835436e3887605822 Mon Sep 17 00:00:00 2001 From: samuelchlui Date: Mon, 19 Nov 2018 12:43:23 +0800 Subject: [PATCH 09/75] perf[style]: use webpack alias instead of hard code src path (#1338) --- src/components/Upload/singleImage3.vue | 2 +- src/views/example/components/ArticleDetail.vue | 2 +- src/views/layout/Layout.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Upload/singleImage3.vue b/src/components/Upload/singleImage3.vue index 637b9e1e..2cce98da 100644 --- a/src/components/Upload/singleImage3.vue +++ b/src/components/Upload/singleImage3.vue @@ -83,7 +83,7 @@ export default { diff --git a/src/views/components-demo/markdown.vue b/src/views/components-demo/markdown.vue index f60911d0..5fb39569 100644 --- a/src/views/components-demo/markdown.vue +++ b/src/views/components-demo/markdown.vue @@ -1,15 +1,40 @@ @@ -17,32 +42,46 @@ import MarkdownEditor from '@/components/MarkdownEditor' const content = ` -**this is test** +**This is test** * vue * element * webpack -## Simplemde ` - export default { name: 'MarkdownDemo', components: { MarkdownEditor }, data() { return { content: content, - html: '' + html: '', + languageTypeList: { + 'en': 'en_US', + 'zh': 'zh_CN', + 'es': 'es_ES' + } + } + }, + computed: { + language() { + return this.languageTypeList[this.$store.getters.language] } }, methods: { - markdown2Html() { - import('showdown').then(showdown => { - const converter = new showdown.Converter() - this.html = converter.makeHtml(this.content) - }) + getHtml() { + this.html = this.$refs.markdownEditor.getHtml() + console.log(this.html) } } } + From c68e68897bf8b2807c6ab939194cbf84eb7b2e3a Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 28 Nov 2018 14:24:30 +0800 Subject: [PATCH 14/75] tweak --- src/views/components-demo/markdown.vue | 4 ++-- src/views/login/index.vue | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/views/components-demo/markdown.vue b/src/views/components-demo/markdown.vue index 5fb39569..de2e817e 100644 --- a/src/views/components-demo/markdown.vue +++ b/src/views/components-demo/markdown.vue @@ -3,8 +3,8 @@ Markdown is based on tui.editor ,Simply encapsulated in Vue. - - 相关文章 + + Documentation
diff --git a/src/views/login/index.vue b/src/views/login/index.vue index d25b519d..bbd3287b 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -107,7 +107,6 @@ export default { }, immediate: true } - }, created() { // window.addEventListener('hashchange', this.afterQRScan) From 4d6e9a535835e192b6b83dc5348e302b383e9e9c Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 29 Nov 2018 18:17:30 +0800 Subject: [PATCH 15/75] fix return back bug --- src/views/errorPage/404.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/errorPage/404.vue b/src/views/errorPage/404.vue index c3eafea0..6483fd5f 100644 --- a/src/views/errorPage/404.vue +++ b/src/views/errorPage/404.vue @@ -14,7 +14,7 @@
{{ message }}
请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告
- 返回首页 + 返回首页 From 46d6f455afb596b6d05a8a61676cbc52ba9214c6 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 4 Dec 2018 14:00:30 +0800 Subject: [PATCH 16/75] fix[Guide-Page]: fix guide page style bug #1391 --- package.json | 2 +- src/views/guide/defineSteps.js | 3 ++- src/views/guide/index.vue | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e02be220..75d88dd4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "clipboard": "1.7.1", "codemirror": "5.39.2", "connect": "3.6.6", - "driver.js": "0.5.2", + "driver.js": "0.8.1", "dropzone": "5.2.0", "echarts": "4.1.0", "element-ui": "2.4.6", diff --git a/src/views/guide/defineSteps.js b/src/views/guide/defineSteps.js index fde78926..405a3f72 100644 --- a/src/views/guide/defineSteps.js +++ b/src/views/guide/defineSteps.js @@ -45,7 +45,8 @@ const steps = [ title: 'Tags view', description: 'The history of the page you visited', position: 'bottom' - } + }, + padding: 0 } ] diff --git a/src/views/guide/index.vue b/src/views/guide/index.vue index c30c52cf..49502aef 100644 --- a/src/views/guide/index.vue +++ b/src/views/guide/index.vue @@ -10,7 +10,7 @@ + + diff --git a/src/views/pdf/index.vue b/src/views/pdf/index.vue new file mode 100644 index 00000000..b7728152 --- /dev/null +++ b/src/views/pdf/index.vue @@ -0,0 +1,9 @@ + + From cc7572820e7cec835548bcc54e2728be4c466f97 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 27 Dec 2018 18:19:11 +0800 Subject: [PATCH 26/75] perf[v-permission]: refine v-permission demo --- src/lang/en.js | 3 +- src/lang/es.js | 3 +- src/lang/zh.js | 3 +- src/views/permission/directive.vue | 71 +++++++++++++++++++++--------- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/lang/en.js b/src/lang/en.js index 656b746b..2af355b1 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -87,7 +87,8 @@ export default { }, permission: { roles: 'Your roles', - switchRoles: 'Switch roles' + switchRoles: 'Switch roles', + tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.' }, guide: { description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ', diff --git a/src/lang/es.js b/src/lang/es.js index 69218ad2..1268f083 100755 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -87,7 +87,8 @@ export default { }, permission: { roles: 'Tus permisos', - switchRoles: 'Cambiar permisos' + switchRoles: 'Cambiar permisos', + tips: 'In some cases it is not suitable to use v-permission, such as element Tab component or el-table-column and other asynchronous rendering dom cases which can only be achieved by manually setting the v-if.' }, guide: { description: 'The guide page is useful for some people who entered the project for the first time. You can briefly introduce the features of the project. Demo is based on ', diff --git a/src/lang/zh.js b/src/lang/zh.js index 021a5fa7..4371713f 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -87,7 +87,8 @@ export default { }, permission: { roles: '你的权限', - switchRoles: '切换权限' + switchRoles: '切换权限', + tips: '在某些情况下,不适合使用 v-permission。例如:Element-UI 的 Tab 组件或 el-table-column 以及其它动态渲染 dom 的场景。你只能通过手动设置 v-if 来实现。' }, guide: { description: '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。本 Demo 是基于', diff --git a/src/views/permission/directive.vue b/src/views/permission/directive.vue index 2817f1c5..df277ddc 100644 --- a/src/views/permission/directive.vue +++ b/src/views/permission/directive.vue @@ -2,29 +2,53 @@
- - Only - admin can see this - - - Only - editor can see this - - - Both - admin and - editor can see this - +
+ + Only + admin can see this + + v-permission="['admin']" +
+ +
+ + Only + editor can see this + + v-permission="['editor']" +
+ +
+ + Both + admin and + editor can see this + + v-permission="['admin','editor']" +
-
- In some cases it is not suitable to use v-permission, such as element Tab component which can only be achieved by manually setting the v-if. +
+ + {{ $t('permission.tips') }}
e.g.
- - Admin can see this - Editor can see this - Both admin or editor can see this + + + + Admin can see this + v-if="checkPermission(['admin'])" + + + + Editor can see this + v-if="checkPermission(['editor'])" + + + + Both admin or editor can see this + v-if="checkPermission(['admin','editor'])" +
@@ -57,14 +81,17 @@ export default{ .app-container { /deep/ .permission-alert { width: 320px; - margin-top: 30px; + margin-top: 15px; background-color: #f0f9eb; color: #67c23a; padding: 8px 16px; border-radius: 4px; - display: block; + display: inline-block; } - /deep/ .permission-tag{ + /deep/ .permission-sourceCode { + margin-left: 15px; + } + /deep/ .permission-tag { background-color: #ecf5ff; } } From 311796a14b034fdd6e670fbb0f415dc12f3a3df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Fri, 28 Dec 2018 15:28:26 +0800 Subject: [PATCH 27/75] perf[Sidebar]: refine sidebar store #1473 (#1474) --- src/store/modules/app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/modules/app.js b/src/store/modules/app.js index bc4fb478..fba4b05c 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -3,7 +3,7 @@ import Cookies from 'js-cookie' const app = { state: { sidebar: { - opened: !+Cookies.get('sidebarStatus'), + opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, withoutAnimation: false }, device: 'desktop', @@ -12,16 +12,16 @@ const app = { }, mutations: { TOGGLE_SIDEBAR: state => { + state.sidebar.opened = !state.sidebar.opened + state.sidebar.withoutAnimation = false if (state.sidebar.opened) { Cookies.set('sidebarStatus', 1) } else { Cookies.set('sidebarStatus', 0) } - state.sidebar.opened = !state.sidebar.opened - state.sidebar.withoutAnimation = false }, CLOSE_SIDEBAR: (state, withoutAnimation) => { - Cookies.set('sidebarStatus', 1) + Cookies.set('sidebarStatus', 0) state.sidebar.opened = false state.sidebar.withoutAnimation = withoutAnimation }, From c98d5787575e6048a7a65f1aed45cafcf7d3acd8 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 31 Dec 2018 21:22:20 +0800 Subject: [PATCH 28/75] [release] 3.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 75d88dd4..66bfe789 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "3.9.3", + "version": "3.10.0", "description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", "license": "MIT", From 3dd29ab07abba639e5ab581e699d3c4b03d53fbc Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 9 Jan 2019 14:48:19 +0800 Subject: [PATCH 29/75] chore: update webpack-dev-server --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66bfe789..8ba9aadf 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "webpack": "4.16.5", "webpack-bundle-analyzer": "2.13.1", "webpack-cli": "3.1.0", - "webpack-dev-server": "3.1.5", + "webpack-dev-server": "3.1.14", "webpack-merge": "4.1.4" }, "engines": { From 68a19d55deddec5c34ee2f81f49b9407b184a6ab Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 9 Jan 2019 14:53:36 +0800 Subject: [PATCH 30/75] fix[chore]: fix error when enable gzip --- build/webpack.prod.conf.js | 1 - package.json | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 946a134a..4f84e0c6 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -150,7 +150,6 @@ if (config.build.productionGzip) { webpackConfig.plugins.push( new CompressionWebpackPlugin({ - asset: '[path].gz[query]', algorithm: 'gzip', test: new RegExp( '\\.(' + config.build.productionGzipExtensions.join('|') + ')$' diff --git a/package.json b/package.json index 8ba9aadf..e5b0b9ec 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "babel-preset-env": "1.7.0", "babel-preset-stage-2": "6.24.1", "chalk": "2.4.1", + "compression-webpack-plugin": "2.0.0", "copy-webpack-plugin": "4.5.2", "cross-env": "5.2.0", "css-loader": "1.0.0", From 9cea3c3abe31746c044db1388d24ee86e343a623 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 9 Jan 2019 16:04:24 +0800 Subject: [PATCH 31/75] refine: GetUserInfo error message --- src/permission.js | 2 +- src/store/modules/user.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/permission.js b/src/permission.js index 81f9d113..e556cb00 100644 --- a/src/permission.js +++ b/src/permission.js @@ -33,7 +33,7 @@ router.beforeEach((to, from, next) => { }) }).catch((err) => { store.dispatch('FedLogOut').then(() => { - Message.error(err || 'Verification failed, please login again') + Message.error(err) next({ path: '/' }) }) }) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 0f7e2296..38e81a36 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -63,15 +63,16 @@ const user = { GetUserInfo({ commit, state }) { return new Promise((resolve, reject) => { getUserInfo(state.token).then(response => { - if (!response.data) { // 由于mockjs 不支持自定义状态码只能这样hack - reject('error') + // 由于mockjs 不支持自定义状态码只能这样hack + if (!response.data) { + reject('Verification failed, please login again.') } const data = response.data if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 commit('SET_ROLES', data.roles) } else { - reject('getInfo: roles must be a non-null array !') + reject('getInfo: roles must be a non-null array!') } commit('SET_NAME', data.name) From 1bb9283eddbba310b72c876dc8807a66b76c26c8 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 10 Jan 2019 05:05:17 +0300 Subject: [PATCH 32/75] fix typo (#1505) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0ff7d74..cf67c757 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s - Multiple dynamic themes - Dynamic sidebar (supports multi-level routing) - Dynamic breadcrumb - - Tags-view(Tab page Support right-click operation) + - Tags-view (Tab page Support right-click operation) - Svg Sprite - Mock data - Screenfull From 5ea614fe5d1fead70f62879410d2cd4358b34e7c Mon Sep 17 00:00:00 2001 From: Duy Nguyen Hoang Date: Fri, 11 Jan 2019 15:37:59 +0800 Subject: [PATCH 33/75] perf: add sidebar width to variables.scss (#1494) --- src/styles/sidebar.scss | 18 +++++++++--------- src/styles/variables.scss | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index faa7366e..2de9fd91 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -1,15 +1,15 @@ #app { - // 主体区域 + // 主体区域 Main container .main-container { min-height: 100%; transition: margin-left .28s; - margin-left: 180px; + margin-left: $sideBarWidth; position: relative; } - // 侧边栏 + // 侧边栏 Sidebar container .sidebar-container { transition: width 0.28s; - width: 180px !important; + width: $sideBarWidth !important; height: 100%; position: fixed; font-size: 0px; @@ -90,29 +90,29 @@ } .sidebar-container .nest-menu .el-submenu>.el-submenu__title, .sidebar-container .el-submenu .el-menu-item { - min-width: 180px !important; + min-width: $sideBarWidth !important; background-color: $subMenuBg !important; &:hover { background-color: $menuHover !important; } } .el-menu--collapse .el-menu .el-submenu { - min-width: 180px !important; + min-width: $sideBarWidth !important; } - //适配移动端 + // 适配移动端, Mobile responsive .mobile { .main-container { margin-left: 0px; } .sidebar-container { transition: transform .28s; - width: 180px !important; + width: $sideBarWidth !important; } &.hideSidebar { .sidebar-container { transition-duration: 0.3s; - transform: translate3d(-180px, 0, 0); + transform: translate3d(-$sideBarWidth, 0, 0); } } } diff --git a/src/styles/variables.scss b/src/styles/variables.scss index acc77a82..1af649c4 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -11,3 +11,5 @@ $panGreen: #30B08F; $menuBg:#304156; $subMenuBg:#1f2d3d; $menuHover:#001528; + +$sideBarWidth: 180px; From c54e99d0a9c9a5ec18300ad60409b8b444771cd9 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 11 Jan 2019 15:42:53 +0800 Subject: [PATCH 34/75] tweak --- src/styles/btn.scss | 7 +- src/styles/element-ui.scss | 129 +++++++++++++++++++------------------ src/styles/index.scss | 20 ++++-- src/styles/mixin.scss | 6 ++ src/styles/sidebar.scss | 40 ++++++++++-- src/styles/transition.scss | 3 +- src/styles/variables.scss | 2 +- 7 files changed, 128 insertions(+), 79 deletions(-) diff --git a/src/styles/btn.scss b/src/styles/btn.scss index 0c5ee768..e6ba1a8e 100644 --- a/src/styles/btn.scss +++ b/src/styles/btn.scss @@ -2,8 +2,10 @@ @mixin colorBtn($color) { background: $color; + &:hover { color: $color; + &:before, &:after { background: $color; @@ -49,14 +51,17 @@ transition: 600ms ease all; position: relative; display: inline-block; + &:hover { background: #fff; + &:before, &:after { width: 100%; transition: 600ms ease all; } } + &:before, &:after { content: ''; @@ -67,6 +72,7 @@ width: 0; transition: 400ms ease all; } + &::after { right: inherit; top: inherit; @@ -91,4 +97,3 @@ font-size: 14px; border-radius: 4px; } - diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss index dc59591e..494dcfa4 100644 --- a/src/styles/element-ui.scss +++ b/src/styles/element-ui.scss @@ -1,82 +1,85 @@ - //覆盖一些element-ui样式 +//覆盖一些element-ui样式 - .el-breadcrumb__inner, .el-breadcrumb__inner a{ - font-weight: 400!important; +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; } - .el-upload { - input[type="file"] { - display: none !important; - } - } +.el-upload { + input[type="file"] { + display: none !important; + } +} - .el-upload__input { - display: none; - } +.el-upload__input { + display: none; +} - .cell { - .el-tag { - margin-right: 0px; - } - } +.cell { + .el-tag { + margin-right: 0px; + } +} - .small-padding { - .cell { - padding-left: 5px; - padding-right: 5px; - } - } +.small-padding { + .cell { + padding-left: 5px; + padding-right: 5px; + } +} - .fixed-width{ - .el-button--mini{ +.fixed-width { + .el-button--mini { padding: 7px 10px; width: 60px; } - } +} - .status-col { - .cell { - padding: 0 10px; - text-align: center; - .el-tag { - margin-right: 0px; - } - } - } +.status-col { + .cell { + padding: 0 10px; + text-align: center; - //暂时性解决dialog 问题 https://github.com/ElemeFE/element/issues/2461 - .el-dialog { - transform: none; - left: 0; - position: relative; - margin: 0 auto; - } + .el-tag { + margin-right: 0px; + } + } +} - //文章页textarea修改样式 - .article-textarea { - textarea { - padding-right: 40px; - resize: none; - border: none; - border-radius: 0px; - border-bottom: 1px solid #bfcbd9; - } - } +//暂时性解决dialog 问题 https://github.com/ElemeFE/element/issues/2461 +.el-dialog { + transform: none; + left: 0; + position: relative; + margin: 0 auto; +} - //element ui upload - .upload-container { - .el-upload { - width: 100%; - .el-upload-dragger { - width: 100%; - height: 200px; - } - } - } +//文章页textarea修改样式 +.article-textarea { + textarea { + padding-right: 40px; + resize: none; + border: none; + border-radius: 0px; + border-bottom: 1px solid #bfcbd9; + } +} + +//element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} //dropdown - .el-dropdown-menu{ - a{ +.el-dropdown-menu { + a { display: block } } diff --git a/src/styles/index.scss b/src/styles/index.scss index b6fd924e..93f2157e 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -22,7 +22,7 @@ html { box-sizing: border-box; } -#app{ +#app { height: 100%; } @@ -53,9 +53,9 @@ a:hover { text-decoration: none; } -div:focus{ +div:focus { outline: none; - } +} .fr { float: right; @@ -104,23 +104,26 @@ code { line-height: 36px; font-size: 15px; font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif; + a { color: #337ab7; cursor: pointer; + &:hover { color: rgb(32, 160, 255); } } } -.warn-content{ - background: rgba(66,185,131,.1); +.warn-content { + background: rgba(66, 185, 131, .1); border-radius: 2px; padding: 16px; padding: 1rem; line-height: 1.6rem; word-spacing: .05rem; - a{ + + a { color: #42b983; font-weight: 600; } @@ -153,13 +156,16 @@ code { padding-right: 20px; transition: 600ms ease position; background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%); + .subtitle { font-size: 20px; color: #fff; } + &.draft { background: #d0d0d0; } + &.deleted { background: #d0d0d0; } @@ -169,6 +175,7 @@ code { .link-type:focus { color: #337ab7; cursor: pointer; + &:hover { color: rgb(32, 160, 255); } @@ -176,6 +183,7 @@ code { .filter-container { padding-bottom: 10px; + .filter-item { display: inline-block; vertical-align: middle; diff --git a/src/styles/mixin.scss b/src/styles/mixin.scss index 822ab92a..06fa0612 100644 --- a/src/styles/mixin.scss +++ b/src/styles/mixin.scss @@ -10,9 +10,11 @@ &::-webkit-scrollbar-track-piece { background: #d3dce6; } + &::-webkit-scrollbar { width: 6px; } + &::-webkit-scrollbar-thumb { background: #99a9bf; border-radius: 20px; @@ -37,21 +39,25 @@ $transparent-border-style: $width solid transparent; height: 0; width: 0; + @if $direction==up { border-bottom: $color-border-style; border-left: $transparent-border-style; border-right: $transparent-border-style; } + @else if $direction==right { border-left: $color-border-style; border-top: $transparent-border-style; border-bottom: $transparent-border-style; } + @else if $direction==down { border-top: $color-border-style; border-left: $transparent-border-style; border-right: $transparent-border-style; } + @else if $direction==left { border-right: $color-border-style; border-top: $transparent-border-style; diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index 2de9fd91..723f9a12 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -1,4 +1,5 @@ #app { + // 主体区域 Main container .main-container { min-height: 100%; @@ -6,6 +7,7 @@ margin-left: $sideBarWidth; position: relative; } + // 侧边栏 Sidebar container .sidebar-container { transition: width 0.28s; @@ -18,62 +20,79 @@ left: 0; z-index: 1001; overflow: hidden; + //reset element-ui css .horizontal-collapse-transition { transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; } + .scrollbar-wrapper { - overflow-x: hidden!important; + overflow-x: hidden !important; + .el-scrollbar__view { height: 100%; } } - .el-scrollbar__bar.is-vertical{ + + .el-scrollbar__bar.is-vertical { right: 0px; } + .is-horizontal { display: none; } + a { display: inline-block; width: 100%; overflow: hidden; } + .svg-icon { margin-right: 16px; } + .el-menu { border: none; height: 100%; width: 100% !important; } - .is-active > .el-submenu__title{ - color: #f4f4f5!important; + + .is-active>.el-submenu__title { + color: #f4f4f5 !important; } } + .hideSidebar { .sidebar-container { width: 36px !important; } + .main-container { margin-left: 36px; } + .submenu-title-noDropdown { padding-left: 10px !important; position: relative; + .el-tooltip { padding: 0 10px !important; } } + .el-submenu { overflow: hidden; + &>.el-submenu__title { padding-left: 10px !important; + .el-submenu__icon-arrow { display: none; } } } + .el-menu--collapse { .el-submenu { &>.el-submenu__title { @@ -88,14 +107,17 @@ } } } + .sidebar-container .nest-menu .el-submenu>.el-submenu__title, .sidebar-container .el-submenu .el-menu-item { min-width: $sideBarWidth !important; background-color: $subMenuBg !important; + &:hover { background-color: $menuHover !important; } } + .el-menu--collapse .el-menu .el-submenu { min-width: $sideBarWidth !important; } @@ -105,10 +127,12 @@ .main-container { margin-left: 0px; } + .sidebar-container { transition: transform .28s; width: $sideBarWidth !important; } + &.hideSidebar { .sidebar-container { transition-duration: 0.3s; @@ -116,7 +140,9 @@ } } } + .withoutAnimation { + .main-container, .sidebar-container { transition: none; @@ -124,9 +150,9 @@ } } -.el-menu--vertical{ - & >.el-menu{ - .svg-icon{ +.el-menu--vertical { + &>.el-menu { + .svg-icon { margin-right: 16px; } } diff --git a/src/styles/transition.scss b/src/styles/transition.scss index 04e16279..ab68317d 100644 --- a/src/styles/transition.scss +++ b/src/styles/transition.scss @@ -16,10 +16,12 @@ .fade-transform-enter-active { transition: all .5s; } + .fade-transform-enter { opacity: 0; transform: translateX(-30px); } + .fade-transform-leave-to { opacity: 0; transform: translateX(30px); @@ -44,4 +46,3 @@ .breadcrumb-leave-active { position: absolute; } - diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 1af649c4..09c3e9b0 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,3 +1,4 @@ +// base color $blue:#324157; $light-blue:#3A71A8; $red:#C03639; @@ -11,5 +12,4 @@ $panGreen: #30B08F; $menuBg:#304156; $subMenuBg:#1f2d3d; $menuHover:#001528; - $sideBarWidth: 180px; From 109c393cc6ee0cb1fc7fe097645cd4ddf1bf980a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 14 Jan 2019 14:07:56 +0800 Subject: [PATCH 35/75] fix[ThemePicker]: fixed bug when oldVal is null (#1517) --- src/components/ThemePicker/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue index e797d6c2..5d1ff8bd 100644 --- a/src/components/ThemePicker/index.vue +++ b/src/components/ThemePicker/index.vue @@ -18,7 +18,8 @@ export default { } }, watch: { - theme(val, oldVal) { + theme(val) { + const oldVal = this.theme if (typeof val !== 'string') return const themeCluster = this.getThemeCluster(val.replace('#', '')) const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) From 77a40745bb702e3f99ce1d2e7110ad3cb7202c69 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 15 Jan 2019 14:14:39 +0800 Subject: [PATCH 36/75] update README.md --- README.zh-CN.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 55882115..d6cacf56 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -40,7 +40,7 @@ - [Wiki](https://github.com/PanJiaChen/vue-element-admin/wiki) -- [Donate](https://panjiachen.github.io/vue-element-admin-site/zh/donate/) +- [Donate](https://panjiachen.gitee.io/vue-element-admin-site/zh/donate) - [Gitee](https://panjiachen.gitee.io/vue-element-admin/) 国内用户可访问该地址在线预览 @@ -214,6 +214,8 @@ Detailed changes for each release are documented in the [release notes](https:// 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink: ![donate](https://panjiachen.github.io/donate/donation.png) +[更多捐赠方式](https://panjiachen.gitee.io/vue-element-admin-site/zh/donate) + [Paypal Me](https://www.paypal.me/panfree23) ## Browsers support From f767fab4cc085361d6177c8ddd492cf4cf791f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Tue, 15 Jan 2019 16:36:03 +0800 Subject: [PATCH 37/75] fix[Breadcrumb]: fixed eslint error (#1521) --- src/components/Breadcrumb/index.vue | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 4b321e06..5bc7a1b8 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -1,7 +1,7 @@ @@ -48,12 +35,8 @@ export default { cursor: pointer; width: 20px; height: 20px; - transform: rotate(90deg); - transition: .38s; - transform-origin: 50% 50%; } - .hamburger.is-active { - transform: rotate(0deg); + transform: rotate(180deg); } From ac8eddf3d7662a36c8ad3f3fde52af12e0a77150 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 22 Jan 2019 16:35:53 +0800 Subject: [PATCH 40/75] update element-ui version --- README.md | 2 +- README.zh-CN.md | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf67c757..bf0e08be 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ vue - element-ui + element-ui Build Status diff --git a/README.zh-CN.md b/README.zh-CN.md index d6cacf56..5dc9f1d7 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -7,7 +7,7 @@ vue - element-ui + element-ui Build Status diff --git a/package.json b/package.json index e5b0b9ec..83e93bce 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "driver.js": "0.8.1", "dropzone": "5.2.0", "echarts": "4.1.0", - "element-ui": "2.4.6", + "element-ui": "2.4.11", "file-saver": "1.3.8", "js-cookie": "2.2.0", "jsonlint": "1.6.3", From 8cf279fbe1e6b698b147a869290138934e003455 Mon Sep 17 00:00:00 2001 From: Yuga Sun Date: Wed, 23 Jan 2019 11:18:02 +0800 Subject: [PATCH 41/75] perf[Login Form]: optimize eye icon style (#1545) * optimiz: eye icon style for login form * change eye-open svg --- src/icons/svg/eye-open.svg | 1 + src/views/login/index.vue | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 src/icons/svg/eye-open.svg diff --git a/src/icons/svg/eye-open.svg b/src/icons/svg/eye-open.svg new file mode 100644 index 00000000..88dcc98e --- /dev/null +++ b/src/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5e872595..a44c6ad3 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,11 +1,11 @@ From eb1d3381f48ff81632b22f944e1f53563ef22a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 24 Jan 2019 11:14:23 +0800 Subject: [PATCH 42/75] perf[Sticky]: export reset method (#1550) --- src/components/Sticky/index.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index e0fb7c57..a287216d 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -56,10 +56,13 @@ export default { this.width = this.width + 'px' this.isSticky = true }, - reset() { + handleReset() { if (!this.active) { return } + this.reset() + }, + reset() { this.position = '' this.width = 'auto' this.active = false @@ -72,7 +75,7 @@ export default { this.sticky() return } - this.reset() + this.handleReset() }, handleReize() { if (this.isSticky) { From 8ef6c7ee7dc7cd78ccbc2545a1ec29fad5243cee Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 24 Jan 2019 13:48:19 +0800 Subject: [PATCH 43/75] perf[Sticky]: refine width default value --- src/components/Sticky/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index a287216d..5624a989 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -69,7 +69,8 @@ export default { this.isSticky = false }, handleScroll() { - this.width = this.$el.getBoundingClientRect().width + const width = this.$el.getBoundingClientRect().width + this.width = width || 'auto' const offsetTop = this.$el.getBoundingClientRect().top if (offsetTop < this.stickyTop) { this.sticky() From 23055c9b2c332930bddac1d25d099fde14390f76 Mon Sep 17 00:00:00 2001 From: xbigcat Date: Thu, 24 Jan 2019 15:32:35 +0800 Subject: [PATCH 44/75] perf[utils]: refine parseTime function (#1546) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 优化 parseTime 修复传入的时间戳是字符串类型,不能转换时间的问题 例:parseTime("1548221490638") * Update index.js --- src/utils/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 0445827b..821392e9 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -11,7 +11,12 @@ export function parseTime(time, cFormat) { if (typeof time === 'object') { date = time } else { - if (('' + time).length === 10) time = parseInt(time) * 1000 + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } date = new Date(time) } const formatObj = { From 3153a1b10bc32e1650c644d829f284d37ee044c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Fri, 25 Jan 2019 12:50:21 +0800 Subject: [PATCH 45/75] perf[UploadExcel]: optimized code (#1552) --- src/components/UploadExcel/index.vue | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/components/UploadExcel/index.vue b/src/components/UploadExcel/index.vue index 20e16398..a6b8dbce 100644 --- a/src/components/UploadExcel/index.vue +++ b/src/components/UploadExcel/index.vue @@ -82,8 +82,7 @@ export default { const reader = new FileReader() reader.onload = e => { const data = e.target.result - const fixedData = this.fixData(data) - const workbook = XLSX.read(btoa(fixedData), { type: 'base64' }) + const workbook = XLSX.read(data, { type: 'array' }) const firstSheetName = workbook.SheetNames[0] const worksheet = workbook.Sheets[firstSheetName] const header = this.getHeaderRow(worksheet) @@ -95,14 +94,6 @@ export default { reader.readAsArrayBuffer(rawFile) }) }, - fixData(data) { - let o = '' - let l = 0 - const w = 10240 - for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w))) - o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w))) - return o - }, getHeaderRow(sheet) { const headers = [] const range = XLSX.utils.decode_range(sheet['!ref']) From 9daeb1cb340136fdbbec021fe20941a97dc41d5b Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 29 Jan 2019 16:54:38 +0800 Subject: [PATCH 46/75] perf: adjust the import order to make it more elegant #1537 --- src/main.js | 2 +- src/store/modules/permission.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 1ce709c9..7739639d 100644 --- a/src/main.js +++ b/src/main.js @@ -10,8 +10,8 @@ import 'element-ui/lib/theme-chalk/index.css' import '@/styles/index.scss' // global css import App from './App' -import router from './router' import store from './store' +import router from './router' import i18n from './lang' // Internationalization import './icons' // icon diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 97de701e..13f60efb 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -36,7 +36,7 @@ function filterAsyncRouter(routes, roles) { const permission = { state: { - routers: constantRouterMap, + routers: [], addRouters: [] }, mutations: { From 727c1a45dd15bd668cfe584a2af8b5b0a9cd28ec Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 29 Jan 2019 18:00:59 +0800 Subject: [PATCH 47/75] perf[Sidebar]: use sass variables in vue template --- src/styles/variables.scss | 12 ++++++++++++ src/views/layout/components/Sidebar/index.vue | 10 +++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 09c3e9b0..87a5dd50 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -12,4 +12,16 @@ $panGreen: #30B08F; $menuBg:#304156; $subMenuBg:#1f2d3d; $menuHover:#001528; +$menuText:#bfcbd9; +$menuActiveText:#409EFF; $sideBarWidth: 180px; + +// the :export directive is the magic sauce for webpack +:export { + menuBg: $menuBg; + subMenuBg: $subMenuBg; + menuHover: $menuHover; + menuText:$menuText; + menuActiveText:$menuActiveText; + sideBarWidth: $sideBarWidth; +} diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index dff85f18..48407286 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -4,10 +4,10 @@ :show-timeout="200" :default-active="$route.path" :collapse="isCollapse" + :background-color="variables.menuBg" + :text-color="variables.menuText" + :active-text-color="variables.menuActiveText" mode="vertical" - background-color="#304156" - text-color="#bfcbd9" - active-text-color="#409EFF" > @@ -17,6 +17,7 @@ - - diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 4cdcb568..5801ba4a 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -1,29 +1,6 @@ @@ -32,20 +9,6 @@ import screenfull from 'screenfull' export default { name: 'Screenfull', - props: { - width: { - type: Number, - default: 22 - }, - height: { - type: Number, - default: 22 - }, - fill: { - type: String, - default: '#48576a' - } - }, data() { return { isFullscreen: false diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue index a92a17c3..6d3cd43a 100644 --- a/src/components/SizeSelect/index.vue +++ b/src/components/SizeSelect/index.vue @@ -53,12 +53,3 @@ export default { } - - - diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue index 5d1ff8bd..332b07e7 100644 --- a/src/components/ThemePicker/index.vue +++ b/src/components/ThemePicker/index.vue @@ -136,7 +136,10 @@ export default { diff --git a/src/icons/svg/search.svg b/src/icons/svg/search.svg new file mode 100644 index 00000000..84233dda --- /dev/null +++ b/src/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 018ef0f9..dcb09ec1 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -6,24 +6,26 @@
- +
@@ -57,6 +59,7 @@ import Screenfull from '@/components/Screenfull' import SizeSelect from '@/components/SizeSelect' import LangSelect from '@/components/LangSelect' import ThemePicker from '@/components/ThemePicker' +import Search from '@/components/HeaderSearch' export default { components: { @@ -66,7 +69,8 @@ export default { Screenfull, SizeSelect, LangSelect, - ThemePicker + ThemePicker, + Search }, computed: { ...mapGetters([ @@ -100,6 +104,7 @@ export default { float: left; cursor: pointer; transition: background .3s; + &:hover { background: rgba(0, 0, 0, .025) } @@ -124,24 +129,30 @@ export default { } .right-menu-item { - cursor: pointer; display: inline-block; padding: 0 8px; height: 100%; - font-size: 20px; + font-size: 18px; color: #5a5e66; vertical-align: text-bottom; - transition: background .3s; - &:hover { - background: rgba(0, 0, 0, .025) + + &.hover-effect { + cursor: pointer; + transition: background .3s; + + &:hover { + background: rgba(0, 0, 0, .025) + } } } .avatar-container { margin-right: 30px; + .avatar-wrapper { margin-top: 5px; position: relative; + .user-avatar { cursor: pointer; width: 40px; From a1d6ad34530854699c38f3d5127c21b293083b93 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 13 Feb 2019 16:10:23 +0800 Subject: [PATCH 57/75] fix[Screenfull]: fix screenfull click bug --- src/components/Screenfull/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 5801ba4a..7f8e6fc3 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -1,6 +1,6 @@ From 0fed69f367899c6f5d3321e5cb86b84faa08d2e9 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 13 Feb 2019 16:34:03 +0800 Subject: [PATCH 58/75] perf[Screenfull]: refactor screenfull component --- package.json | 2 +- src/components/Screenfull/index.vue | 6 ++++-- src/icons/svg/exit-fullscreen.svg | 1 + src/icons/svg/{screenfull.svg => fullscreen.svg} | 0 src/lang/en.js | 1 - src/lang/es.js | 1 - src/lang/zh.js | 1 - src/views/layout/components/Navbar.vue | 4 +--- 8 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 src/icons/svg/exit-fullscreen.svg rename src/icons/svg/{screenfull.svg => fullscreen.svg} (100%) diff --git a/package.json b/package.json index 5854b8d6..77c25de4 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", - "screenfull": "3.3.3", + "screenfull": "4.0.0", "showdown": "1.8.6", "sortablejs": "1.7.0", "tui-editor": "1.2.7", diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 7f8e6fc3..8e7bcba4 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -1,6 +1,6 @@ @@ -23,7 +23,9 @@ export default { }) return false } - screenfull.toggle() + screenfull.toggle().then(() => { + this.isFullscreen = screenfull.isFullscreen + }) } } } diff --git a/src/icons/svg/exit-fullscreen.svg b/src/icons/svg/exit-fullscreen.svg new file mode 100644 index 00000000..485c128b --- /dev/null +++ b/src/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/screenfull.svg b/src/icons/svg/fullscreen.svg similarity index 100% rename from src/icons/svg/screenfull.svg rename to src/icons/svg/fullscreen.svg diff --git a/src/lang/en.js b/src/lang/en.js index ef98af4b..05b34598 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -69,7 +69,6 @@ export default { logOut: 'Log Out', dashboard: 'Dashboard', github: 'Github', - screenfull: 'Screenfull', theme: 'Theme', size: 'Global Size' }, diff --git a/src/lang/es.js b/src/lang/es.js index ed71fc15..8575d382 100755 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -69,7 +69,6 @@ export default { logOut: 'Salir', dashboard: 'Panel de control', github: 'Github', - screenfull: 'Pantalla completa', theme: 'Tema', size: 'Tamaño global' }, diff --git a/src/lang/zh.js b/src/lang/zh.js index 7da0ccee..1fd18355 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -69,7 +69,6 @@ export default { logOut: '退出登录', dashboard: '首页', github: '项目地址', - screenfull: '全屏', theme: '换肤', size: '布局大小' }, diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index dcb09ec1..5c3bcda4 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -10,9 +10,7 @@ - - - + From 9ed5db044f22bd9feb88dca6ce8ec7d08f7b8088 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 14 Feb 2019 10:57:57 +0800 Subject: [PATCH 59/75] perf[deps]: move connect to devDependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77c25de4..aef30525 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "axios": "0.18.0", "clipboard": "1.7.1", "codemirror": "5.39.2", - "connect": "3.6.6", "driver.js": "0.8.1", "dropzone": "5.2.0", "echarts": "4.1.0", @@ -77,6 +76,7 @@ "babel-preset-stage-2": "6.24.1", "chalk": "2.4.1", "compression-webpack-plugin": "2.0.0", + "connect": "3.6.6", "copy-webpack-plugin": "4.5.2", "cross-env": "5.2.0", "css-loader": "1.0.0", From 8c18c000d42d913be7bd03c933964d388852cc43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Fri, 15 Feb 2019 10:03:34 +0800 Subject: [PATCH 60/75] fix[Screenfull]: fix screenfull bug (#1603) --- src/components/Screenfull/index.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 8e7bcba4..479bf3e3 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -14,6 +14,9 @@ export default { isFullscreen: false } }, + mounted() { + this.init() + }, methods: { click() { if (!screenfull.enabled) { @@ -23,9 +26,14 @@ export default { }) return false } - screenfull.toggle().then(() => { - this.isFullscreen = screenfull.isFullscreen - }) + screenfull.toggle() + }, + init() { + if (screenfull.enabled) { + screenfull.on('change', () => { + this.isFullscreen = screenfull.isFullscreen + }) + } } } } From 4e0559833fe7ec8ad13d3ca9ac26f3d1ee039927 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 15 Feb 2019 14:54:57 +0800 Subject: [PATCH 61/75] fix typo --- src/router/index.js | 4 ++-- src/views/layout/components/Sidebar/FixiOSBug.js | 10 +++++----- src/views/layout/components/Sidebar/SidebarItem.vue | 2 +- src/views/layout/components/Sidebar/index.vue | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index dda18156..a86e3a13 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -12,7 +12,7 @@ import chartsRouter from './modules/charts' import tableRouter from './modules/table' import nestedRouter from './modules/nested' -/** note: Submenu only appear when children.length>=1 +/** note: sub-menu only appear when children.length>=1 * detail see https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html **/ @@ -25,7 +25,7 @@ import nestedRouter from './modules/nested' * name:'router-name' the name is used by (must set!!!) * meta : { roles: ['admin','editor'] will control the page roles (you can set multiple roles) - title: 'title' the name show in submenu and breadcrumb (recommend set) + title: 'title' the name show in sub-menu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar noCache: true if true, the page will no be cached(default is false) breadcrumb: false if false, the item will hidden in breadcrumb(default is true) diff --git a/src/views/layout/components/Sidebar/FixiOSBug.js b/src/views/layout/components/Sidebar/FixiOSBug.js index 5e0a9262..bc14856f 100644 --- a/src/views/layout/components/Sidebar/FixiOSBug.js +++ b/src/views/layout/components/Sidebar/FixiOSBug.js @@ -5,16 +5,16 @@ export default { } }, mounted() { - // In order to fix the click on menu on the ios device will trigger the mouseeleave bug + // In order to fix the click on menu on the ios device will trigger the mouseleave bug // https://github.com/PanJiaChen/vue-element-admin/issues/1135 this.fixBugIniOS() }, methods: { fixBugIniOS() { - const $submenu = this.$refs.submenu - if ($submenu) { - const handleMouseleave = $submenu.handleMouseleave - $submenu.handleMouseleave = (e) => { + const $subMenu = this.$refs.subMenu + if ($subMenu) { + const handleMouseleave = $subMenu.handleMouseleave + $subMenu.handleMouseleave = (e) => { if (this.device === 'mobile') { return } diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 56edf9f7..f0381a90 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -9,7 +9,7 @@ - + diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index 48407286..11ef4c02 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -1,7 +1,6 @@ @@ -27,6 +28,7 @@