From cbdad9cb1b836edccf9e25a3154bca9fc097326a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Thu, 25 Oct 2018 10:42:18 +0800 Subject: [PATCH 01/16] fix[TagsView]: fix openMenu boundary display bug (#1256) --- src/views/layout/components/TagsView.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/views/layout/components/TagsView.vue b/src/views/layout/components/TagsView.vue index c9413129..c16827b6 100644 --- a/src/views/layout/components/TagsView.vue +++ b/src/views/layout/components/TagsView.vue @@ -121,11 +121,21 @@ export default { this.$router.push('/') }, openMenu(tag, e) { + const menuMinWidth = 105 + const offsetLeft = this.$el.getBoundingClientRect().left // container margin left + const offsetWidth = this.$el.offsetWidth // container width + const maxLeft = offsetWidth - menuMinWidth // left boundary + const left = e.clientX - offsetLeft + 15 // 15: margin right + + if (left > maxLeft) { + this.left = maxLeft + } else { + this.left = left + } + this.top = e.clientY + this.visible = true this.selectedTag = tag - const offsetLeft = this.$el.getBoundingClientRect().left // container margin left - this.left = e.clientX - offsetLeft + 15 // 15: margin right - this.top = e.clientY }, closeMenu() { this.visible = false From 1d684b76328e3f6bcd3f75ea011087cce1c13a3c Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 26 Oct 2018 10:44:18 +0800 Subject: [PATCH 02/16] [release] 3.9.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7bbaa960..d795d163 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "3.9.2", + "version": "3.9.3", "description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", "license": "MIT", From 1701fcce5d8f43d96ca61109d2b08d4d106b18d5 Mon Sep 17 00:00:00 2001 From: LarchLiu Date: Fri, 2 Nov 2018 15:07:39 +0800 Subject: [PATCH 03/16] 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 04/16] 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 05/16] 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 06/16] 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 07/16] 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 08/16] 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 09/16] 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 10/16] 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 11/16] 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 16/16] 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)