no message

Former-commit-id: 8f37a9ab91003199586822548b2ab4dad4365c48 [formerly 8f37a9ab91003199586822548b2ab4dad4365c48 [formerly 8f37a9ab91003199586822548b2ab4dad4365c48 [formerly 8f37a9ab91003199586822548b2ab4dad4365c48 [formerly 3fa57671ce059dc9105498324d796124c44eec20 [formerly 54ef70a9aa6c2fbdc3afaae82c583a9dd6184f36]]]]]
Former-commit-id: 73e125775a9b96c0728dcfe440ff7af50c9c2d83
Former-commit-id: 28362f415fc8ff668487d44eca347fb136ccffc7
Former-commit-id: 36403ff71596b74bef716028c0d25b2c53bad953 [formerly fb4c3201d0455bcb70913f1fd6662ac2d5088162]
Former-commit-id: cfd5272e3169363c9b545687d6e0a016c9b596d0
Former-commit-id: fcf7cbb087c38e8f5cefcfe19a03b3d54c25e87d
Former-commit-id: 0cea4eda5d45dc00a58dde26cf10663f8fa3f125
Former-commit-id: f651e4e2b3047e7a5cacd7ea71228af5601c53ca
Former-commit-id: c795caab437ec1189c1252838e5532135894b693
This commit is contained in:
liyang
2018-07-01 09:18:17 +08:00
parent 41d03890dd
commit 75406e3d31
3 changed files with 60 additions and 25 deletions

View File

@@ -4,7 +4,8 @@
:value="pageCurrent"
type="card"
:closable="true"
@tab-click="handleClick">
@tab-click="handleClick"
@edit="handleTabsEdit">
<el-tab-pane
v-for="(page, index) in pageOpenedList"
:key="index"
@@ -38,6 +39,49 @@ export default {
query: page.query
})
}
},
handleTabsEdit(tagName, action) {
if (action === 'remove') {
this.closeTag(tagName)
}
},
/**
* 关闭一个指定的 tag
*/
closeTag (tagName) {
// 下个新的页面
let newPage = this.pageOpenedList[0]
// 如果关闭的页面就是当前显示的页面
if (this.pageCurrent === tagName) {
// 去找一个新的页面
let len = this.pageOpenedList.length
for (let i = 1; i < len; i++) {
if (this.pageOpenedList[i].name === tagName) {
if (i < len - 1) {
newPage = this.pageOpenedList[i + 1]
} else {
newPage = this.pageOpenedList[i - 1]
}
break
}
}
} else {
// 关闭的页面不是当前的页面
// 这里暂时不需要做什么
}
this.$store.commit('d2adminTagClose', tagName)
if (this.pageCurrent === tagName) {
this.linkTo(newPage)
}
},
// TODO: 需要完善赋值
linkTo ({ name, argu, query }) {
let routerObj = {
name,
params: argu || {},
query
}
this.$router.push(routerObj)
}
}
}

View File

@@ -1,26 +1,5 @@
<template>
<d2-container type="full" class="page">
theme setting coming soon
<d2-container>
<d2-theme-list/>
</d2-container>
</template>
<script>
export default {
data () {
return {}
},
computed: {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/style/public.scss';
.page {
// Your page style here
// Do not use empty rulesets
// If empty, delete it
}
</style>

View File

@@ -60,7 +60,7 @@ export default {
state.tagPool = tagPool
},
/**
* 新增一个 tag
* 新增一个 tag (打开一个页面)
* @param {state} state vuex state
* @param {object} param1 new tag info
*/
@@ -82,6 +82,18 @@ export default {
}).write()
}
},
/**
* 关闭一个 tag (关闭一个页面)
* @param {state} state vuex state
* @param {string} name close tag name
*/
d2adminTagClose (state, name) {
// 找到这个页面在已经打开的数据里是第几个
const index = state.pageOpenedList.findIndex(page => page.name === name)
if (index >= 0) {
state.pageOpenedList.splice(index, 1)
}
},
/**
* 切换全屏
* @param {state} state vuex state