<keep-alive> <router-view :key="$route.fullPath" :detail="resData" @reload="loadData" /> </keep-alive>
时间: 2023-10-30 12:08:57 浏览: 182
通过vue提供的keep-alive减少对服务器的请求次数
This code block represents a Vue.js component that uses a "keep-alive" tag to cache the component's state when it is not currently visible on the screen, and then use that cached state when it becomes visible again.
Within the "keep-alive" tag, there is a "router-view" tag that renders the current route's component, passing in the current route's full path as a prop, as well as a "detail" prop that is set to the "resData" object. Additionally, there is an event listener for a "reload" event that triggers the "loadData" method when fired.
阅读全文