Closed smmzyl closed 1 year ago
<CacheSwitch aliveControl={aliveControl}> { projectRouters.map((item, index) => { const { path, component, authority, redirectPath, ...rest } = item return item.cache ? ( // return ( <CacheRoute exact when="always" key={index} path={item.path} component={item.component} authority={authority} redirectPath={redirectPath} saveScrollPosition cacheKey="cacheKey" behavior={cached => (cached ? { style: { position: 'absolute', zIndex: -1024, opacity: 0, visibility: 'hidden', pointerEvents: 'none' }, className: '__CacheRoute__wrapper__cached' } : { className: '__CacheRoute__wrapper__uncached' } )} {...rest} /> ) : <AuthorizedRoute key={index} path={item.path} component={item.component} authority={authority} redirectPath={redirectPath} {...rest} > </AuthorizedRoute> }) } </CacheSwitch >
可以使用手动缓存控制