diff --git a/src/views/example/components/ArticleDetail.vue b/src/views/example/components/ArticleDetail.vue index fc19eb6c..f25f7e9e 100644 --- a/src/views/example/components/ArticleDetail.vue +++ b/src/views/example/components/ArticleDetail.vue @@ -3,9 +3,6 @@ - - 创建form - {{!postForm.comment_disabled?'评论已打开':'评论已关闭'}} @@ -55,6 +52,9 @@
+

+ 创建和编辑页面是不能被keep-alive缓存的,因为keep-alive目前不支持根据路由来缓存,所以目前都是基于component name来缓存的,如果你想要实现缓存的效果,可以使用localstorage等游览器缓存方案。或者不要使用keep-alive 的include,直接缓存所有页面。 +

diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 653d1810..6cb7d2b2 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -2,7 +2,7 @@
- +
@@ -14,10 +14,10 @@ export default { computed: { cachedViews() { return this.$store.state.tagsView.cachedViews + }, + key() { + return this.$route.fullPath } - // key() { - // return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date() - // } } } diff --git a/src/views/layout/components/TagsView.vue b/src/views/layout/components/TagsView.vue index c3199338..55467fc9 100644 --- a/src/views/layout/components/TagsView.vue +++ b/src/views/layout/components/TagsView.vue @@ -59,7 +59,7 @@ export default { return false }, isActive(route) { - return route.path === this.$route.path || route.name === this.$route.name + return route.path === this.$route.path }, addViewTags() { const route = this.generateRoute()