Vue-element-admin: 顶部面包屑右边的页面tab可以点击以后保持之前的状态吗?

Created on 30 Aug 2017  ·  5Comments  ·  Source: PanJiaChen/vue-element-admin

后台使用这些功能多是方便切换对比操作

Most helpful comment

这就是要在router-view外面包裹一个keep-alive
https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/layout/AppMain.vue#L4
并且去除router-view上面的key

All 5 comments

这就是要在router-view外面包裹一个keep-alive
https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/layout/AppMain.vue#L4
并且去除router-view上面的key

谢谢

@PanJiaChen ,请问,我在router-view外包裹了一层keep-alive。好像所有的页面都缓存了,但我有些页面不想缓存下来,比如添加或者编辑页面,提交之后。重新打开表单数据还是存在,需要手动清除。
问能不能按需缓存页面呀,
我自己在AppMain.vue文件修改
<keep-alive v-if="$route.meta.isKeepAlive"> <router-view></router-view> </keep-alive> <router-view v-if="!$route.meta.isKeepAlive"></router-view>
好像也不行,求大神帮忙看看?

@allen-hxn
keep-alive 有include 和 exclude
详情看文档 https://cn.vuejs.org/v2/api/#keep-alive

这就是要在router-view外面包裹一个keep-alive
https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/layout/AppMain.vue#L4
并且去除router-view上面的key

大佬,可以保持tab高度状态吗?经常切出去后再回来,又重置到顶部位置了,略困扰,希望tab来回切时,能够保持无刷新的感觉。

Was this page helpful?
0 / 5 - 0 ratings