+
+
+
+ @edit="handleTabsEdit"
+ @contextmenu.native="handleContextmenu">
-
+ :name="page.name"/>
+
import { mapState, mapMutations } from 'vuex'
export default {
+ components: {
+ D2Contextmenu: () => import('../contextmenu'),
+ D2ContextmenuList: () => import('../contextmenu/components/contentmenuList')
+ },
+ data () {
+ return {
+ contextmenuFlag: false,
+ contentmenuX: 0,
+ contentmenuY: 0,
+ contextmenuListIndex: [
+ { icon: 'times-circle', title: '关闭全部', value: 'all' }
+ ],
+ contextmenuList: [
+ { icon: 'arrow-left', title: '关闭左侧', value: 'left' },
+ { icon: 'arrow-right', title: '关闭右侧', value: 'right' },
+ { icon: 'times', title: '关闭其它', value: 'other' },
+ { icon: 'times-circle', title: '关闭全部', value: 'all' }
+ ],
+ tagName: 'index'
+ }
+ },
computed: {
...mapState({
pageOpenedList: state => state.d2admin.pageOpenedList,
@@ -63,19 +95,46 @@ export default {
'd2adminTagCloseOther',
'd2adminTagCloseAll'
]),
+ /**
+ * @description 右键菜单功能点击
+ */
+ handleContextmenu (event) {
+ let target = event.target
+ if (target.className.indexOf('el-tabs__item') > -1 || target.parentNode.className.indexOf('el-tabs__item') > -1) {
+ event.preventDefault()
+ event.stopPropagation()
+ this.contentmenuX = event.clientX
+ this.contentmenuY = event.clientY
+ this.tagName = target.getAttribute('aria-controls').slice(5)
+ this.contextmenuFlag = true
+ }
+ },
+ /**
+ * @description 右键菜单的row-click事件
+ */
+ contextmenuClick (command) {
+ this.handleControlItemClick(command, this.tagName)
+ },
/**
* @description 接收点击关闭控制上选项的事件
*/
- handleControlItemClick (command) {
+ handleControlItemClick (command, tagName = null) {
+ if (tagName) {
+ this.contextmenuFlag = false
+ }
+ const params = {
+ pageSelect: tagName,
+ vm: this
+ }
switch (command) {
case 'left':
- this.d2adminTagCloseLeft()
+ this.d2adminTagCloseLeft(params)
break
case 'right':
- this.d2adminTagCloseRight()
+ this.d2adminTagCloseRight(params)
break
case 'other':
- this.d2adminTagCloseOther()
+ this.d2adminTagCloseOther(params)
break
case 'all':
this.d2adminTagCloseAll(this)
diff --git a/src/layout/header-aside/layout.vue b/src/layout/header-aside/layout.vue
index 6ce51d7..20a2fcf 100644
--- a/src/layout/header-aside/layout.vue
+++ b/src/layout/header-aside/layout.vue
@@ -6,7 +6,7 @@
-