umi-plugin-keep-alive icon indicating copy to clipboard operation
umi-plugin-keep-alive copied to clipboard

为啥这样写缓存会失效啊

Open yl196356303 opened this issue 2 years ago • 5 comments

image

yl196356303 avatar Oct 18 '22 03:10 yl196356303

const outlet = useOutlet()
const location = useLocation()
<KeepAlive id={location.key}>{outlet}</KeepAlive>

CJY0208 avatar Oct 18 '22 06:10 CJY0208

image 还是会失效。。。

yl196356303 avatar Oct 18 '22 06:10 yl196356303

image 还是会失效。。。

外层包了 AliveScope 吗

xiaofuuu avatar Dec 23 '22 02:12 xiaofuuu

image image 这样就好了

Js-Man-H5 avatar Dec 26 '23 05:12 Js-Man-H5

已经解决了,原来location.key每次都会不相同,导致缓存失效

yl196356303 avatar Dec 26 '23 05:12 yl196356303