Merge pull request #1478 from dataease/pr@dev@fix_tabs

fix: tabs组件新增多个
This commit is contained in:
fit2cloud-chenyw 2021-12-20 17:35:35 +08:00 committed by GitHub
commit a52fc0cc80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -142,7 +142,7 @@ export default {
}) })
}, },
addTab() { addTab() {
bus.$emit('add-new-tab') bus.$emit('add-new-tab', this.curComponent.id)
}, },
// //
linkJumpSet() { linkJumpSet() {

View File

@ -134,10 +134,14 @@ export default {
tabList: [] tabList: []
} }
}, },
computed: {
...mapState([
'curComponent'
])
},
watch: { watch: {
curComponent: { curComponent: {
handler(newVal, oldVla) { handler(newVal, oldVla) {
console.log(newVal)
}, },
deep: true deep: true
} }
@ -147,11 +151,6 @@ export default {
this.tabList = this.element.options && this.element.options.tabList this.tabList = this.element.options && this.element.options.tabList
this.activeTabName = this.tabList[0].name this.activeTabName = this.tabList[0].name
}, },
computed: {
...mapState([
'curComponent'
])
},
methods: { methods: {
beforeHandleCommond(item, param) { beforeHandleCommond(item, param) {
return { return {
@ -244,7 +243,8 @@ export default {
this.styleChange() this.styleChange()
}, },
addNewTab() { addNewTab(componentId) {
if (!componentId || componentId !== this.element.id) return
const curName = uuid.v1() const curName = uuid.v1()
const tab = { const tab = {
title: 'NewTab', title: 'NewTab',