From 39617f64be91d0d8e2a90a9e1a2a34eb096b6916 Mon Sep 17 00:00:00 2001 From: han_feng Date: Wed, 14 Nov 2018 15:34:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B8=A6=E5=8F=82?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=A4=9A=E9=A1=B5=E7=AD=BE=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: cbc33a78c59c6468df3e905a1bc1f5c513abf804 [formerly cbc33a78c59c6468df3e905a1bc1f5c513abf804 [formerly cbc33a78c59c6468df3e905a1bc1f5c513abf804 [formerly cbc33a78c59c6468df3e905a1bc1f5c513abf804 [formerly 66e615a1681dbb8ff72633fc3d53cbf5411610f5 [formerly 449c1c2a13a19d6d52537b97c18548c012b360dd]]]]] Former-commit-id: 2a7a63bce617f5acaf5c1e4b13455f001f69118d Former-commit-id: 49a1453a0343e1e52cbb1b7faf1d18ffbb0ae519 Former-commit-id: d303a906c5a794ef68376044fb6d9c578e9e85c9 [formerly bc51b43eaa43b3d1744d7edc36d605a6d3d0cd2e] Former-commit-id: 8867f09a27c99223dfd2cb5e66b2b25ca75b49d9 Former-commit-id: 2f01e346f3474822a2ec1f50e02ffcce05dce8a8 Former-commit-id: 8f68a3470559ea51ee3ab7617347eb0236b607f1 Former-commit-id: dbcf55c5cfcb9f52dc8705397a2423f790d7ed82 Former-commit-id: 58abe040aadabc72c1db5acef2f45a7f30874614 --- .../header-aside/components/tabs/index.vue | 8 +++---- src/menu/modules/demo-playground.js | 4 +++- .../demo/playground/page-cache/params.vue | 22 +++++++++++++++++++ src/router/index.js | 4 ++-- src/router/modules/playground.js | 1 + src/setting.js | 1 + .../d2admin/modules/page.js.REMOVED.git-id | 2 +- 7 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 src/pages/demo/playground/page-cache/params.vue diff --git a/src/layout/header-aside/components/tabs/index.vue b/src/layout/header-aside/components/tabs/index.vue index d1a77676..45b4e029 100644 --- a/src/layout/header-aside/components/tabs/index.vue +++ b/src/layout/header-aside/components/tabs/index.vue @@ -7,7 +7,7 @@ :x="contentmenuX" :y="contentmenuY"> + :name="page.fullPath"/> @@ -79,7 +79,7 @@ export default { { icon: 'times', title: '关闭其它', value: 'other' }, { icon: 'times-circle', title: '关闭全部', value: 'all' } ], - tagName: 'index' + tagName: '/index' } }, computed: { @@ -163,7 +163,7 @@ export default { */ handleClick (tab, event) { // 找到点击的页面在 tag 列表里是哪个 - const page = this.opened.find(page => page.name === tab.name) + const page = this.opened.find(page => page.fullPath === tab.name) const { name, params, query } = page if (page) { this.$router.push({ name, params, query }) diff --git a/src/menu/modules/demo-playground.js b/src/menu/modules/demo-playground.js index 71ec355a..eb84d2d9 100644 --- a/src/menu/modules/demo-playground.js +++ b/src/menu/modules/demo-playground.js @@ -58,7 +58,9 @@ export default { icon: 'hdd-o', children: [ { path: `${pre}page-cache/on`, title: '开启缓存' }, - { path: `${pre}page-cache/off`, title: '关闭缓存' } + { path: `${pre}page-cache/off`, title: '关闭缓存' }, + { path: `${pre}page-cache/params/1`, title: '带参路由缓存 1' }, + { path: `${pre}page-cache/params/2`, title: '带参路由缓存 2' } ] }, { diff --git a/src/pages/demo/playground/page-cache/params.vue b/src/pages/demo/playground/page-cache/params.vue new file mode 100644 index 00000000..90f032e7 --- /dev/null +++ b/src/pages/demo/playground/page-cache/params.vue @@ -0,0 +1,22 @@ + + + diff --git a/src/router/index.js b/src/router/index.js index 4cf7d272..241e6215 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -55,9 +55,9 @@ router.afterEach(to => { NProgress.done() // 需要的信息 const app = router.app - const { name, params, query } = to + const { name, params, query, fullPath } = to // 多页控制 打开新的页面 - app.$store.dispatch('d2admin/page/open', { name, params, query }) + app.$store.dispatch('d2admin/page/open', { name, params, query, fullPath }) // 更改标题 util.title(to.meta.title) }) diff --git a/src/router/modules/playground.js b/src/router/modules/playground.js index f2bd74d3..b2d6a7b1 100644 --- a/src/router/modules/playground.js +++ b/src/router/modules/playground.js @@ -20,6 +20,7 @@ export default { { path: 'store/transition', name: `${pre}store-transition`, component: () => import('@/pages/demo/playground/store/transition'), meta: { ...meta, title: '页面过渡开关' } }, { path: 'page-cache/on', name: `${pre}page-cache-on`, component: () => import('@/pages/demo/playground/page-cache/on.vue'), meta: { ...meta, cache: true, title: '开启缓存' } }, { path: 'page-cache/off', name: `${pre}page-cache-off`, component: () => import('@/pages/demo/playground/page-cache/off.vue'), meta: { ...meta, title: '关闭缓存' } }, + { path: 'page-cache/params/:id', name: `${pre}page-cache-params`, component: () => import('@/pages/demo/playground/page-cache/params.vue'), meta: { ...meta, cache: true, title: '带参路由缓存' }, props: true }, { path: 'page-argu/send', name: `${pre}page-argu-send`, component: () => import('@/pages/demo/playground/page-argu/send.vue'), meta: { ...meta, title: '参数传递 发送' } }, { path: 'page-argu/get/:username', name: `${pre}page-argu-get`, component: () => import('@/pages/demo/playground/page-argu/get.vue'), meta: { ...meta, title: '参数传递 接收' } }, { path: 'db/all', name: `${pre}db-all`, component: () => import('@/pages/demo/playground/db/all'), meta: { ...meta, title: '总览' } }, diff --git a/src/setting.js b/src/setting.js index f6f4016e..66ed4bd1 100644 --- a/src/setting.js +++ b/src/setting.js @@ -18,6 +18,7 @@ export default { opened: [ { name: 'index', + fullPath: '/index', meta: { title: '首页', requiresAuth: false diff --git a/src/store/modules/d2admin/modules/page.js.REMOVED.git-id b/src/store/modules/d2admin/modules/page.js.REMOVED.git-id index 5a5e14b3..b42d384d 100644 --- a/src/store/modules/d2admin/modules/page.js.REMOVED.git-id +++ b/src/store/modules/d2admin/modules/page.js.REMOVED.git-id @@ -1 +1 @@ -b640559cb03d106f8ed74403b61a7af0561e5015 \ No newline at end of file +033fcecc7eeff02cfda00a5ded8a23cb359855f1 \ No newline at end of file From 201ead0f143da03d6c69c992c0c5ca38a2deff3e Mon Sep 17 00:00:00 2001 From: han_feng Date: Wed, 14 Nov 2018 16:24:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0NoMock=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 53eec152a91d65dbd0e2a4583c311fea2fe1c1c7 [formerly 53eec152a91d65dbd0e2a4583c311fea2fe1c1c7 [formerly 53eec152a91d65dbd0e2a4583c311fea2fe1c1c7 [formerly 53eec152a91d65dbd0e2a4583c311fea2fe1c1c7 [formerly c444975758b78dccb4417961afb6742968c896b1 [formerly dc590efc1303bd1368312e1641c481b0c4a8dbc7]]]]] Former-commit-id: 1d0794f07342a190108aa8503d50d3951f3da9d7 Former-commit-id: 4407cc381a0f6202bba464e8f81046f8e50ae6c8 Former-commit-id: 7cae2a4aa50e146cc4c051f8bf45828e66d925f6 [formerly 586f3af810f4b0402d839b2d3b960379d6e57d48] Former-commit-id: 28cc51bee72e51ea218e9c6a96011c264654f407 Former-commit-id: 7589bbd29c3df02ee14b111f55b560b374f779f8 Former-commit-id: 4b34228333185d62a4da20cdc57e481f09fd062d Former-commit-id: bcc587834afb148202698b4f56f8fc29354e25ed Former-commit-id: 3683c4bd65bacca11e47555140fb38d1e102cee1 --- .env.nomock | 7 +++++++ package.json | 1 + src/main.js | 2 -- vue.config.js | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .env.nomock diff --git a/.env.nomock b/.env.nomock new file mode 100644 index 00000000..0c644c80 --- /dev/null +++ b/.env.nomock @@ -0,0 +1,7 @@ +# No Mock 构建 + +# 指定构建模式 +NODE_ENV=production + +# 标记当前是 No Mock 构建 +VUE_APP_BUILD_MODE=nomock diff --git a/package.json b/package.json index f5d7c7e4..3e8324d6 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "npm run serve", "dev": "npm run serve", "build": "vue-cli-service build", + "build:nomock": "vue-cli-service build --mode nomock", "build:travis": "vue-cli-service build --mode travis", "lint": "vue-cli-service lint --fix", "test:unit": "vue-cli-service test:unit" diff --git a/src/main.js b/src/main.js index 3704dc78..b11a2976 100644 --- a/src/main.js +++ b/src/main.js @@ -5,8 +5,6 @@ import Vue from 'vue' import App from './App' // store import store from '@/store/index' -// 模拟数据 -import '@/mock' // 多国语 import i18n from './i18n' // 核心插件 diff --git a/vue.config.js b/vue.config.js index aa5136af..f2f2f446 100644 --- a/vue.config.js +++ b/vue.config.js @@ -57,5 +57,11 @@ module.exports = { entry .add('babel-polyfill') .end() + if (process.env.VUE_APP_BUILD_MODE !== 'nomock') { + // 加入模拟数据 + entry + .add('@/mock') + .end() + } } } From fecc0fed0e8a7694e7a50ead8373314b755a9cbb Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 14 Nov 2018 19:46:17 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: d40c51afd20ff6c8b75343b110c4a885494d13d6 [formerly d40c51afd20ff6c8b75343b110c4a885494d13d6 [formerly d40c51afd20ff6c8b75343b110c4a885494d13d6 [formerly d40c51afd20ff6c8b75343b110c4a885494d13d6 [formerly 8e89c9de19c7589bfef2ed381c4d04e5ffa10342 [formerly 43a6b0713d5f72c905ec7115dee22d64349905bc]]]]] Former-commit-id: 7f951c4f7afbcde61758bc064d58b48a27f60b2e Former-commit-id: 3ae33b4cb8fd3a6e217ea188db468378ec45a755 Former-commit-id: c1fbcedaf8f0742871894db45bc4f5fdd0a81401 [formerly fc2d9e0c6f21015a6a40af6baa2ea77cfe6e07d2] Former-commit-id: a4fb93d4c675d59173e6a44897a17f27c36f7cea Former-commit-id: e1d7b3b4afc1221bfc31a8079b05b1cc0bf2ee3e Former-commit-id: 78de6f0e3afe650160da32723a88e8d5337fbbf2 Former-commit-id: 1e79f8a1bb257fba62c3a711741f788e2f61cb8e Former-commit-id: d6563a9fbd5956d549fa6dc7ae36045d922da1fb --- src/layout/header-aside/components/menu-side/index.vue | 8 ++++---- src/pages/demo/playground/page-cache/params.vue | 2 +- src/store/modules/d2admin/modules/account.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/layout/header-aside/components/menu-side/index.vue b/src/layout/header-aside/components/menu-side/index.vue index 76e3585d..f451f1c3 100644 --- a/src/layout/header-aside/components/menu-side/index.vue +++ b/src/layout/header-aside/components/menu-side/index.vue @@ -55,12 +55,12 @@ export default { }, 500) }, // 监听路由 控制侧边栏激活状态 - '$route.matched': { - handler (val) { - this.active = val[val.length - 1].path + '$route': { + handler ({ fullPath }) { + this.active = fullPath this.$nextTick(() => { if (this.aside.length > 0 && this.$refs.menu) { - this.$refs.menu.activeIndex = this.active + this.$refs.menu.activeIndex = fullPath } }) }, diff --git a/src/pages/demo/playground/page-cache/params.vue b/src/pages/demo/playground/page-cache/params.vue index 90f032e7..7ce777ba 100644 --- a/src/pages/demo/playground/page-cache/params.vue +++ b/src/pages/demo/playground/page-cache/params.vue @@ -1,7 +1,7 @@