當頁面列表有查看 修改等操作 需要緩存當前頁面
給router-view設置key爲路由的完整路徑即可。最後找到這種實現方案,能夠解決我的問題,實在簡單!
:include="caheList" //緩存這個組件
原文地址:https://segmentfault.com/a/1190000018703137
<keep-alive :include="cacheList">
<router-view :key="$route.fullPath"></router-view>
</keep-alive>