Vue3 中如何使用 keep-alive 包裹根组件
在 Vue3 中,虽然可以使用以下代码将根元素包裹在`
<template>
<keep-alive>
<div>
<!-- your root component code here -->
</div>
</keep-alive>
</template>
但需要注意,在 Vue3 中,使用`
建议使用`
- 页面中的多个视图组件
- 复杂组件内部需要缓存的部分
通过合理的运用`
原文地址: https://www.cveoy.top/t/topic/lNpC 著作权归作者所有。请勿转载和采集!