vue 关闭当前tab页,并更新父组件数据
export default {
data () {
return {
componentKey: 0
}
}
},
methods: {
onSubmit() {
let tabName = this.$store.state.contentTabsActiveName
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
if (this.$store.state.contentTabs.length <= 0) {
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = 'home'
return false
}
let tab = this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1]
this.$router.push({
name: tab.name,
params: { ...tab.params },
query: { ...tab.query }
})
this.componentKey += 1;
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28