Former-commit-id: 1801c7a5909d5415b360a996d4ecab23280b1076 [formerly 1801c7a5909d5415b360a996d4ecab23280b1076 [formerly 1801c7a5909d5415b360a996d4ecab23280b1076 [formerly 1801c7a5909d5415b360a996d4ecab23280b1076 [formerly 209999b1c78ca63880406cb2b633c3560aae0eba [formerly 54edc3b4bd966e2496564198d59ff84fe9ba0b25]]]]]
Former-commit-id: ad91a7092b963def0579ecc2011e578e87a8ecd5
Former-commit-id: fb96644ac016362df708618fafef872b7bc2567c
Former-commit-id: 257c0b84b8069b3ccb8ddc53e965a974fca01189 [formerly 6954456a39b73136a14f80b0747aea90a694c9a5]
Former-commit-id: 99c7481e576afeac70fff4effa7e57f6b17cb79d
Former-commit-id: cfddcdd7f760c61e4abe02159a75d484ad6c6e63
Former-commit-id: 06d4e8cf94bd8c24fa167d77f843c93541afb5e6
Former-commit-id: ef6879d28d953c827184c4d5caa6c7fef6b2326f
Former-commit-id: 1f1114b417621402ec7d9d3540b305563fb140ec
This commit is contained in:
liyang
2018-08-10 13:49:54 +08:00
parent 0453ab7f36
commit 551aa111a1
10 changed files with 424 additions and 32 deletions

View File

@@ -12,14 +12,14 @@
</d2-contextmenu>
<el-tabs
class="d2-multiple-page-control"
:value="pageCurrent"
:value="current"
type="card"
:closable="true"
@tab-click="handleClick"
@edit="handleTabsEdit"
@contextmenu.native="handleContextmenu">
<el-tab-pane
v-for="(page, index) in pageOpenedList"
v-for="(page, index) in opened"
:key="index"
:label="page.meta.title || '未命名'"
:name="page.name"/>
@@ -82,17 +82,18 @@ export default {
}
},
computed: {
...mapState('d2admin', [
'pageOpenedList',
'pageCurrent'
...mapState('d2admin/page', [
'opened',
'current'
])
},
methods: {
...mapMutations('d2admin', [
'tagCloseLeft',
'tagCloseRight',
'tagCloseOther',
'tagCloseAll'
...mapMutations('d2admin/page', [
'close',
'closeLeft',
'closeRight',
'closeOther',
'closeAll'
]),
/**
* @description 右键菜单功能点击
@@ -136,16 +137,16 @@ export default {
}
switch (command) {
case 'left':
this.tagCloseLeft(params)
this.closeLeft(params)
break
case 'right':
this.tagCloseRight(params)
this.closeRight(params)
break
case 'other':
this.tagCloseOther(params)
this.closeOther(params)
break
case 'all':
this.tagCloseAll(this)
this.closeAll(this)
break
default:
this.$message.error('无效的操作')
@@ -156,14 +157,14 @@ export default {
* @description 接收点击关闭控制上按钮的事件
*/
handleControlBtnClick () {
this.tagCloseAll(this)
this.closeAll(this)
},
/**
* @description 接收点击 tab 标签的事件
*/
handleClick (tab, event) {
// 找到点击的页面在 tag 列表里是哪个
const page = this.pageOpenedList.find(page => page.name === tab.name)
const page = this.opened.find(page => page.name === tab.name)
const { name, params, query } = page
if (page) {
this.$router.push({ name, params, query })
@@ -174,7 +175,7 @@ export default {
*/
handleTabsEdit (tagName, action) {
if (action === 'remove') {
this.$store.commit('d2admin/tagClose', {
this.close({
tagName,
vm: this
})