From b627d3d0ba887962f73585d5f9d41745d017f2c8 Mon Sep 17 00:00:00 2001 From: derrick <1145390845@qq.com> Date: Tue, 9 Apr 2019 12:56:57 +0800 Subject: [PATCH 01/10] fix[TagsView]: fixed close last page bug(#1866) --- src/layout/components/TagsView/index.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index f06f5156..19d3083f 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -145,7 +145,7 @@ export default { closeSelectedTag(view) { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { if (this.isActive(view)) { - this.toLastView(visitedViews) + this.toLastView(visitedViews, view) } }) }, @@ -160,16 +160,22 @@ export default { if (this.affixTags.some(tag => tag.path === view.path)) { return } - this.toLastView(visitedViews) + this.toLastView(visitedViews, view) }) }, - toLastView(visitedViews) { + toLastView(visitedViews, view) { const latestView = visitedViews.slice(-1)[0] if (latestView) { this.$router.push(latestView) } else { - // You can set another route - this.$router.push('/') + // now the default is to redirect to the home page if there is no tags-view, + // you can adjust it according to your needs. + if (view.name === 'Dashboard') { + // to reload home page + this.$router.replace({ path: '/redirect' + view.fullPath }) + } else { + this.$router.push('/') + } } }, openMenu(tag, e) { From dbee6ff707479967c8d843fd89b040b6e7828fb0 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 9 Apr 2019 14:25:14 +0800 Subject: [PATCH 02/10] refactor[mock-server]: refactor mock-server #1860 --- mock/mock-server.js | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/mock/mock-server.js b/mock/mock-server.js index 99346afb..af7e67ee 100644 --- a/mock/mock-server.js +++ b/mock/mock-server.js @@ -3,12 +3,16 @@ const bodyParser = require('body-parser') const chalk = require('chalk') function registerRoutes(app) { + let mockStartIndex const { default: mocks } = require('./index.js') for (const mock of mocks) { app[mock.type](mock.url, mock.response) + mockStartIndex = app._router.stack.length } + const mockRoutesLength = Object.keys(mocks).length return { - mockRoutesLength: Object.keys(mocks).length + mockRoutesLength: mockRoutesLength, + mockStartIndex: mockStartIndex - mockRoutesLength } } @@ -20,28 +24,6 @@ function unregisterRoutes() { }) } -function getPath(path) { - var match = path.toString() - .replace('\\/?', '') - .replace('(?=\\/|$)', '$') - .match(/^\/\^((?:\\[.*+?^${}()|[\]\\\/]|[^.*+?^${}()|[\]\\\/])*)\$\//) - return match - ? match[1].replace(/\\(.)/g, '$1').split('/') - : path.toString() -} - -function getMockRoutesIndex(app) { - for (let index = 0; index <= app._router.stack.length; index++) { - const r = app._router.stack[index] - if (r.route && r.route.path) { - const path = getPath(r.route.path) - if (path.includes('mock')) { - return index - } - } - } -} - module.exports = app => { // es6 polyfill require('@babel/register') @@ -53,7 +35,9 @@ module.exports = app => { extended: true })) - const { mockRoutesLength } = registerRoutes(app) + const mockRoutes = registerRoutes(app) + var mockRoutesLength = mockRoutes.mockRoutesLength + var mockStartIndex = mockRoutes.mockStartIndex // watch files, hot reload mock server chokidar.watch(('./mock'), { @@ -62,16 +46,15 @@ module.exports = app => { ignoreInitial: true }).on('all', (event, path) => { if (event === 'change' || event === 'add') { - // find mock routes stack index - const index = getMockRoutesIndex(app) - // remove mock routes stack - app._router.stack.splice(index, mockRoutesLength) + app._router.stack.splice(mockStartIndex, mockRoutesLength) // clear routes cache unregisterRoutes() - registerRoutes(app) + const mockRoutes = registerRoutes(app) + mockRoutesLength = mockRoutes.mockRoutesLength + mockStartIndex = mockRoutes.mockStartIndex console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`)) } From 9cba45e97135833a430a2803c2bf325fd6b85c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Wed, 10 Apr 2019 10:12:16 +0800 Subject: [PATCH 03/10] fix[Sidebar]: fixed external link bug (#1870) --- src/layout/components/Sidebar/SidebarItem.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 8c9c4328..b4422cf8 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -86,6 +86,9 @@ export default { if (isExternal(routePath)) { return routePath } + if (isExternal(this.basePath)) { + return this.basePath + } return path.resolve(this.basePath, routePath) }, From aa9d48905f9f12e292038f8eeb0b27c003ae61f7 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 10 Apr 2019 15:54:47 +0800 Subject: [PATCH 04/10] [release] 4.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1b59855b..72e92927 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "4.0.0", + "version": "4.0.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 035c7d78f18b23d33ffadf47d97da91c00e1f2fe Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 11 Apr 2019 09:42:44 +0800 Subject: [PATCH 05/10] docs: change some http links to https --- .editorconfig | 2 +- README.md | 10 +++++----- README.zh-CN.md | 8 ++++---- mock/mock-server.js | 2 +- src/views/components-demo/splitpane.vue | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.editorconfig b/.editorconfig index ea6e20f5..3454886e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# http://editorconfig.org +# https://editorconfig.org root = true [*] diff --git a/README.md b/README.md index 48599a7e..b8b8447d 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ English | [简体中文](./README.zh-CN.md) ## Introduction -[vue-element-admin](http://panjiachen.github.io/vue-element-admin) is a production-ready front-end solution for admin interfaces. It based on [vue](https://github.com/vuejs/vue) and use the UI Toolkit [element-ui](https://github.com/ElemeFE/element). +[vue-element-admin](https://panjiachen.github.io/vue-element-admin) is a production-ready front-end solution for admin interfaces. It based on [vue](https://github.com/vuejs/vue) and use the UI Toolkit [element-ui](https://github.com/ElemeFE/element). It is a magical vue admin based on the newest development stack of vue, built-in i18n solution, typical templates for enterprise applications, lots of awesome features. It helps you build a large complex Single-Page Applications. I believe whatever your needs are, this project will help you. -- [Preview](http://panjiachen.github.io/vue-element-admin) +- [Preview](https://panjiachen.github.io/vue-element-admin) - [Documentation](https://panjiachen.github.io/vue-element-admin-site/) @@ -56,7 +56,7 @@ It is a magical vue admin based on the newest development stack of vue, built-in ## Preparation -You need to install [node](http://nodejs.org/) and [git](https://git-scm.com/) locally. The project is based on [ES2015+](http://es6.ruanyifeng.com/), [vue](https://cn.vuejs.org/index.html), [vuex](https://vuex.vuejs.org/zh-cn/), [vue-router](https://router.vuejs.org/zh-cn/), [vue-cli](https://github.com/vuejs/vue-cli) , [axios](https://github.com/axios/axios) and [element-ui](https://github.com/ElemeFE/element), all request data is simulated using [Mock.js](https://github.com/nuysoft/Mock). +You need to install [node](https://nodejs.org/) and [git](https://git-scm.com/) locally. The project is based on [ES2015+](https://es6.ruanyifeng.com/), [vue](https://cn.vuejs.org/index.html), [vuex](https://vuex.vuejs.org/zh-cn/), [vue-router](https://router.vuejs.org/zh-cn/), [vue-cli](https://github.com/vuejs/vue-cli) , [axios](https://github.com/axios/axios) and [element-ui](https://github.com/ElemeFE/element), all request data is simulated using [Mock.js](https://github.com/nuysoft/Mock). Understanding and learning this knowledge in advance will greatly help the use of this project.

@@ -187,7 +187,7 @@ Detailed changes for each release are documented in the [release notes](https:// ## Online Demo -[Preview](http://panjiachen.github.io/vue-element-admin) +[Preview](https://panjiachen.github.io/vue-element-admin) ## Donate @@ -203,7 +203,7 @@ If you find this project useful, you can buy author a glass of juice :tropical_d Modern browsers and Internet Explorer 10+. -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| [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 diff --git a/README.zh-CN.md b/README.zh-CN.md index e0ec09bb..21d1eb7b 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -30,9 +30,9 @@ ## 简介 -[vue-element-admin](http://panjiachen.github.io/vue-element-admin) 是一个后台前端解决方案,它基于 [vue](https://github.com/vuejs/vue) 和 [element-ui](https://github.com/ElemeFE/element)实现。它使用了最新的前端技术栈,内置了 i18n 国际化解决方案,动态路由,权限验证,提炼了典型的业务模型,提供了丰富的功能组件,它可以帮助你快速搭建企业级中后台产品原型。相信不管你的需求是什么,本项目都能帮助到你。 +[vue-element-admin](https://panjiachen.github.io/vue-element-admin) 是一个后台前端解决方案,它基于 [vue](https://github.com/vuejs/vue) 和 [element-ui](https://github.com/ElemeFE/element)实现。它使用了最新的前端技术栈,内置了 i18n 国际化解决方案,动态路由,权限验证,提炼了典型的业务模型,提供了丰富的功能组件,它可以帮助你快速搭建企业级中后台产品原型。相信不管你的需求是什么,本项目都能帮助到你。 -- [在线预览](http://panjiachen.github.io/vue-element-admin) +- [在线预览](https://panjiachen.github.io/vue-element-admin) - [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/) @@ -204,7 +204,7 @@ Detailed changes for each release are documented in the [release notes](https:// ## Online Demo -[在线 Demo](http://panjiachen.github.io/vue-element-admin) +[在线 Demo](https://panjiachen.github.io/vue-element-admin) ## Donate @@ -221,7 +221,7 @@ Detailed changes for each release are documented in the [release notes](https:// Modern browsers and Internet Explorer 10+. -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | +| [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 diff --git a/mock/mock-server.js b/mock/mock-server.js index af7e67ee..fcb931ad 100644 --- a/mock/mock-server.js +++ b/mock/mock-server.js @@ -29,7 +29,7 @@ module.exports = app => { require('@babel/register') // parse app.body - // http://expressjs.com/en/4x/api.html#req.body + // https://expressjs.com/en/4x/api.html#req.body app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ extended: true diff --git a/src/views/components-demo/splitpane.vue b/src/views/components-demo/splitpane.vue index 72b62014..4259abea 100644 --- a/src/views/components-demo/splitpane.vue +++ b/src/views/components-demo/splitpane.vue @@ -1,7 +1,7 @@ diff --git a/src/views/errorPage/401.vue b/src/views/error-page/401.vue similarity index 100% rename from src/views/errorPage/401.vue rename to src/views/error-page/401.vue diff --git a/src/views/errorPage/404.vue b/src/views/error-page/404.vue similarity index 100% rename from src/views/errorPage/404.vue rename to src/views/error-page/404.vue diff --git a/src/views/example/components/ArticleDetail.vue b/src/views/example/components/ArticleDetail.vue index 2213e927..58574ab0 100644 --- a/src/views/example/components/ArticleDetail.vue +++ b/src/views/example/components/ArticleDetail.vue @@ -76,12 +76,12 @@ diff --git a/src/views/table/inlineEditTable.vue b/src/views/table/inline-edit-table.vue similarity index 100% rename from src/views/table/inlineEditTable.vue rename to src/views/table/inline-edit-table.vue