mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
fix: Without data refreshing on different child tab than the first. (#433)
This commit is contained in:
parent
b5451f5dfb
commit
a617189dc7
@ -34,6 +34,11 @@ export default {
|
|||||||
MainPanel
|
MainPanel
|
||||||
},
|
},
|
||||||
mixins: [tabMixin],
|
mixins: [tabMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currentTab: this.$route.query.tabParent
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
tabParentStyle() {
|
tabParentStyle() {
|
||||||
// if tabs children is showed or closed
|
// if tabs children is showed or closed
|
||||||
@ -70,6 +75,19 @@ export default {
|
|||||||
})
|
})
|
||||||
this.$route.meta.tabUuid = this.tabUuid
|
this.$route.meta.tabUuid = this.tabUuid
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
tabUuid(value) {
|
||||||
|
this.setCurrentTab()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setCurrentTab() {
|
||||||
|
this.$store.dispatch('setCurrentTab', {
|
||||||
|
parentUuid: this.windowUuid,
|
||||||
|
containerUuid: this.tabUuid,
|
||||||
|
window: this.windowMetadata
|
||||||
|
})
|
||||||
|
this.$route.meta.tabUuid = this.tabUuid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,14 +52,9 @@ export default {
|
|||||||
getterDataParentTab() {
|
getterDataParentTab() {
|
||||||
return this.$store.getters.getDataRecordAndSelection(this.firstTabUuid)
|
return this.$store.getters.getDataRecordAndSelection(this.firstTabUuid)
|
||||||
},
|
},
|
||||||
getterIsLoadRecordParent() {
|
|
||||||
return this.getterDataParentTab.isLoaded
|
|
||||||
},
|
|
||||||
getterIsLoadContextParent() {
|
|
||||||
return this.getterDataParentTab.isLoadedContext
|
|
||||||
},
|
|
||||||
isReadyFromGetData() {
|
isReadyFromGetData() {
|
||||||
return !this.getDataSelection.isLoaded && this.getterIsLoadContextParent && this.getterIsLoadRecordParent
|
const { isLoaded, isLoadedContext } = this.getterDataParentTab
|
||||||
|
return !this.getDataSelection.isLoaded && isLoaded && isLoadedContext
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -91,8 +86,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.setCurrentTabChild()
|
this.setCurrentTabChild()
|
||||||
|
const currentIndex = parseInt(this.currentTabChild, 10)
|
||||||
|
this.tabUuid = this.tabsList[currentIndex].uuid
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
if (this.isReadyFromGetData) {
|
if (this.isReadyFromGetData) {
|
||||||
this.getDataTable()
|
this.getDataTable()
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,8 @@ export const tabMixin = {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentTab: this.$route.query.tabParent,
|
|
||||||
tabUuid: '',
|
tabUuid: '',
|
||||||
panelType: 'window',
|
panelType: 'window'
|
||||||
firstTableName: this.tabsList[0].tableName
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -32,29 +30,18 @@ export const tabMixin = {
|
|||||||
this.tabUuid = this.tabsList[0].uuid
|
this.tabUuid = this.tabsList[0].uuid
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
parseContext,
|
|
||||||
//
|
|
||||||
getDataTable() {
|
getDataTable() {
|
||||||
this.$store.dispatch('getDataListTab', {
|
this.$store.dispatch('getDataListTab', {
|
||||||
parentUuid: this.windowUuid,
|
parentUuid: this.windowUuid,
|
||||||
containerUuid: this.tabUuid
|
containerUuid: this.tabUuid
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setCurrentTab() {
|
|
||||||
this.$store.dispatch('setCurrentTab', {
|
|
||||||
parentUuid: this.windowUuid,
|
|
||||||
containerUuid: this.tabUuid,
|
|
||||||
window: this.windowMetadata
|
|
||||||
})
|
|
||||||
this.$route.meta.tabUuid = this.tabUuid
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* @param {object} tabHTML DOM HTML the tab clicked
|
* @param {object} tabHTML DOM HTML the tab clicked
|
||||||
*/
|
*/
|
||||||
handleClick(tabHTML) {
|
handleClick(tabHTML) {
|
||||||
if (this.tabUuid !== tabHTML.$attrs.tabuuid) {
|
if (this.tabUuid !== tabHTML.$attrs.tabuuid) {
|
||||||
this.tabUuid = tabHTML.$attrs.tabuuid
|
this.tabUuid = tabHTML.$attrs.tabuuid
|
||||||
this.setCurrentTab()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleBeforeLeave(activeName) {
|
handleBeforeLeave(activeName) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user