Merge branch 'develop' of github.com:han-feng/d2-admin into hotfix/han-feng-pr

Former-commit-id: 7c88efa2d097413cc17662a477f203733808f483 [formerly 7c88efa2d097413cc17662a477f203733808f483 [formerly 7c88efa2d097413cc17662a477f203733808f483 [formerly 7c88efa2d097413cc17662a477f203733808f483 [formerly 122edcf1cd60d6c1cd70ab257e387f654fc8baf0 [formerly 40665454071df523b652ed69ff863a13da062520]]]]]
Former-commit-id: 7e59718fd8ed81bae6ee35b3bcca7d398f166e7f
Former-commit-id: d642f92ff1170ad1f6dbc019c47b3d3469e25168
Former-commit-id: 62e9427636ac64866a984d080be9a72d24af410d [formerly 3a3d208f8632ba0f750f98fd1fec7f0bebe02940]
Former-commit-id: 1caab3cba24922e32b5c6f617e9d3e808f496362
Former-commit-id: e89fe0d578941c32add88ceb134c27e4981a4107
Former-commit-id: 337c4253a2bdcf7ce6a92a079ac7dafc24477ccc
Former-commit-id: 33c09aac32c07af8a1335ccae0761255c4096d8d
Former-commit-id: cb62c5fad312a6eb0d2c86a10ee2ed7a7e8b8e27
This commit is contained in:
liyang
2018-11-14 18:15:22 +08:00
11 changed files with 48 additions and 10 deletions

7
.env.nomock Normal file
View File

@@ -0,0 +1,7 @@
# No Mock 构建
# 指定构建模式
NODE_ENV=production
# 标记当前是 No Mock 构建
VUE_APP_BUILD_MODE=nomock

View File

@@ -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"

View File

@@ -7,7 +7,7 @@
:x="contentmenuX"
:y="contentmenuY">
<d2-contextmenu-list
:menulist="tagName === 'index' ? contextmenuListIndex : contextmenuList"
:menulist="tagName === '/index' ? contextmenuListIndex : contextmenuList"
@rowClick="contextmenuClick"/>
</d2-contextmenu>
<el-tabs
@@ -22,7 +22,7 @@
v-for="(page, index) in opened"
:key="index"
:label="page.meta.title || '未命名'"
:name="page.name"/>
:name="page.fullPath"/>
</el-tabs>
</div>
</div>
@@ -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 })

View File

@@ -5,8 +5,6 @@ import Vue from 'vue'
import App from './App'
// store
import store from '@/store/index'
// 模拟数据
import '@/mock'
// 多国语
import i18n from './i18n'
// 核心插件

View File

@@ -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' }
]
},
{

View File

@@ -0,0 +1,22 @@
<template>
<d2-container type="card">
<template slot="header">这个页面会被 keep-alive</template>
<h1>编号{{id}}</h1>
<p class="d2-mt-0">在下面的输入框输入任意字符后切换到其它页面再回到此页时输入框文字保留证明被缓存</p>
<el-input v-model="value" placeholder="input here"></el-input>
</d2-container>
</template>
<script>
export default {
name: 'demo-playground-page-cache-params',
props: {
id: String
},
data () {
return {
value: ''
}
}
}
</script>

View File

@@ -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)
})

View File

@@ -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: '总览' } },

View File

@@ -18,6 +18,7 @@ export default {
opened: [
{
name: 'index',
fullPath: '/index',
meta: {
title: '首页',
requiresAuth: false

View File

@@ -1 +1 @@
b640559cb03d106f8ed74403b61a7af0561e5015
033fcecc7eeff02cfda00a5ded8a23cb359855f1

View File

@@ -57,5 +57,11 @@ module.exports = {
entry
.add('babel-polyfill')
.end()
if (process.env.VUE_APP_BUILD_MODE !== 'nomock') {
// 加入模拟数据
entry
.add('@/mock')
.end()
}
}
}