Caching routes doest work in nested routes ,so providing addCachedView between the concrete route and route with component Layout provides solution
This commit is contained in:
parent
33a93a12b4
commit
0c010d7d3d
|
@ -105,6 +105,10 @@ export default {
|
|||
addTags() {
|
||||
const { name } = this.$route
|
||||
if (name) {
|
||||
const matchedRoutes = this.$route.matched
|
||||
for (let i = 1; i < matchedRoutes.length - 1; i++) {
|
||||
this.$store.dispatch('tagsView/addCachedView', matchedRoutes[i])
|
||||
}
|
||||
this.$store.dispatch('tagsView/addView', this.$route)
|
||||
}
|
||||
return false
|
||||
|
@ -135,6 +139,12 @@ export default {
|
|||
})
|
||||
},
|
||||
closeSelectedTag(view) {
|
||||
const matchedRoutes = view.matched
|
||||
for (let i = 1; i < matchedRoutes.length - 1; i++) {
|
||||
this.$store.dispatch('tagsView/delCachedView', matchedRoutes[i]).then(response => {
|
||||
console.log('Deleted cached views')
|
||||
})
|
||||
}
|
||||
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
|
||||
if (this.isActive(view)) {
|
||||
this.toLastView(visitedViews, view)
|
||||
|
|
|
@ -5,3 +5,14 @@
|
|||
</el-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'Menu1',
|
||||
created() {
|
||||
console.log('Menu-1 created')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -5,3 +5,13 @@
|
|||
</el-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Menu11',
|
||||
created() {
|
||||
console.log('Menu-1-1 created')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue