mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +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
|
||||
},
|
||||
mixins: [tabMixin],
|
||||
data() {
|
||||
return {
|
||||
currentTab: this.$route.query.tabParent
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
tabParentStyle() {
|
||||
// if tabs children is showed or closed
|
||||
@ -70,6 +75,19 @@ export default {
|
||||
})
|
||||
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() {
|
||||
return this.$store.getters.getDataRecordAndSelection(this.firstTabUuid)
|
||||
},
|
||||
getterIsLoadRecordParent() {
|
||||
return this.getterDataParentTab.isLoaded
|
||||
},
|
||||
getterIsLoadContextParent() {
|
||||
return this.getterDataParentTab.isLoadedContext
|
||||
},
|
||||
isReadyFromGetData() {
|
||||
return !this.getDataSelection.isLoaded && this.getterIsLoadContextParent && this.getterIsLoadRecordParent
|
||||
const { isLoaded, isLoadedContext } = this.getterDataParentTab
|
||||
return !this.getDataSelection.isLoaded && isLoaded && isLoadedContext
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -91,8 +86,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.setCurrentTabChild()
|
||||
const currentIndex = parseInt(this.currentTabChild, 10)
|
||||
this.tabUuid = this.tabsList[currentIndex].uuid
|
||||
},
|
||||
mounted() {
|
||||
if (this.isReadyFromGetData) {
|
||||
this.getDataTable()
|
||||
}
|
||||
|
@ -17,10 +17,8 @@ export const tabMixin = {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentTab: this.$route.query.tabParent,
|
||||
tabUuid: '',
|
||||
panelType: 'window',
|
||||
firstTableName: this.tabsList[0].tableName
|
||||
panelType: 'window'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -32,29 +30,18 @@ export const tabMixin = {
|
||||
this.tabUuid = this.tabsList[0].uuid
|
||||
},
|
||||
methods: {
|
||||
parseContext,
|
||||
//
|
||||
getDataTable() {
|
||||
this.$store.dispatch('getDataListTab', {
|
||||
parentUuid: this.windowUuid,
|
||||
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
|
||||
*/
|
||||
handleClick(tabHTML) {
|
||||
if (this.tabUuid !== tabHTML.$attrs.tabuuid) {
|
||||
this.tabUuid = tabHTML.$attrs.tabuuid
|
||||
this.setCurrentTab()
|
||||
}
|
||||
},
|
||||
handleBeforeLeave(activeName) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user