提炼公用代码

Former-commit-id: 278f2272b7aba737b5b3c49b621f3cc00a2a150c [formerly 278f2272b7aba737b5b3c49b621f3cc00a2a150c [formerly 278f2272b7aba737b5b3c49b621f3cc00a2a150c [formerly 278f2272b7aba737b5b3c49b621f3cc00a2a150c [formerly 80c5397e852a3591eb6d5f8ea6bb6a2d90e03fb8 [formerly 47d97d4d5741cfd6e23f282d6594e51bc150a621]]]]]
Former-commit-id: 5fc3fc935765addc6a7fa782a445e814232efa4e
Former-commit-id: 3f9539bae4c59d3fa7ebbf8f8ff0aeeeba5ff10a
Former-commit-id: 60d9cda4fcbf4bdbe9c07a0581cd1ccaa07e4fa0 [formerly 3b54a6f6dbaa5596c726eabd195673352683dfb6]
Former-commit-id: 4e844aa5cc7e264914eda04efc151b39f7f744db
Former-commit-id: 70a7aed8d8514dcb7e933997167f5e95186a859a
Former-commit-id: 481e5d5540367905e9216d9473a378d7b9db0da7
Former-commit-id: 836c189615ae01df385ec3d5473f1b65d571a4ef
Former-commit-id: 69cb56832d34116ce3e4cfdd29c036153fa0aa5a
This commit is contained in:
liyang
2018-07-13 21:52:04 +08:00
parent 648682d83f
commit 85ff55029a

View File

@@ -48,7 +48,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapMutations } from 'vuex'
export default { export default {
data () { data () {
return { return {
@@ -62,33 +62,38 @@ export default {
}) })
}, },
methods: { methods: {
...mapMutations([
'd2adminTagCloseLeft',
'd2adminTagCloseRight',
'd2adminTagCloseOther',
'd2adminTagCloseAll'
]),
/** /**
* @description 接收点击关闭控制上选项的事件 * @description 接收点击关闭控制上选项的事件
*/ */
handleControlItemClick (command) { handleControlItemClick (command) {
switch (command) { switch (command) {
case 'left': case 'left':
this.closeAllTagLeft() this.handleCloseAllTagLeft()
break break
case 'right': case 'right':
this.closeAllTagRight() this.handleCloseAllTagRight()
break break
case 'other': case 'other':
this.closeAllTagOther() this.handleCloseAllTagOther()
break break
case 'all': case 'all':
this.closeAllTag() this.handleCloseAllTag()
break break
default: default:
console.log('无效指令') this.$message.error('无效的操作')
break break
} }
}, },
/** /**
* @description 接收点击关闭控制上按钮的事件 * @description 接收点击关闭控制上按钮的事件 暂时这个按钮还只有关闭全部标签的功能
*/ */
handleControlBtnClick () { handleControlBtnClick () {
// 关闭所有
this.closeAllTag() this.closeAllTag()
}, },
/** /**
@@ -116,26 +121,26 @@ export default {
/** /**
* @description 关闭左侧的 tag * @description 关闭左侧的 tag
*/ */
closeAllTagLeft () { handleCloseAllTagLeft () {
this.$store.commit('d2adminTagCloseLeft') this.d2adminTagCloseLeft()
}, },
/** /**
* @description 关闭右侧的 tag * @description 关闭右侧的 tag
*/ */
closeAllTagRight () { handleCloseAllTagRight () {
this.$store.commit('d2adminTagCloseRight') this.d2adminTagCloseRight()
}, },
/** /**
* @description 关闭其它的 tag * @description 关闭其它的 tag
*/ */
closeAllTagOther () { handleCloseAllTagOther () {
this.$store.commit('d2adminTagCloseOther') this.d2adminTagCloseOther()
}, },
/** /**
* @description 关闭全部的 tag * @description 关闭全部的 tag
*/ */
closeAllTag () { handleCloseAllTag () {
this.$store.commit('d2adminTagCloseAll', this) this.d2adminTagCloseAll(this)
}, },
/** /**
* @description 关闭一个指定的 tag * @description 关闭一个指定的 tag
@@ -157,25 +162,17 @@ export default {
break break
} }
} }
} else {
// 关闭的页面不是当前的页面
// 这里暂时不需要做什么
} }
this.$store.commit('d2adminTagClose', tagName) this.$store.commit('d2adminTagClose', tagName)
if (this.pageCurrent === tagName) { if (this.pageCurrent === tagName) {
this.linkTo(newPage) const { name = '', argu = {}, query = {} } = newPage
let routerObj = {
name,
params: argu,
query
}
this.$router.push(routerObj)
} }
},
/**
* @description 跳转到新的页面
*/
linkTo ({ name = '', argu = {}, query = {} }) {
let routerObj = {
name,
params: argu,
query
}
this.$router.push(routerObj)
} }
} }
} }