umi-plugin-route-cache
v1.0.3
Published
umi keep alive
Downloads
3
Readme
umi-plugin-route-cache
umi keep alive
Usage
Configure in .umirc.js
,
export default {
plugins: [
['umi-plugin-route-cache', {
keepalive:['route path','route path']
}],
],
}
Init 初始化
package.json
"scripts": {
"start": "umi dev",
"init": "umi keepalive",
},
yarn run init
Configuration Routing 配置路由
Configure in .umirc.js
,
export default {
plugins: [
['umi-plugin-route-cache'],
],
routes: [
{
path: '/',
component: '../layouts/index',
routes: [
{
path: '/list',
component: './list',
keepAlive: true,
},
{
path: '/item',
component: './item',
},
],
},
]
};
Conventional Routing 约定式路由
Configure in .umirc.js
,
export default {
plugins: [
['umi-plugin-route-cache', {
keepalive:['/list']
}],
],
}
Manual release 手动解除keep
import { dropByCacheKey } from 'umi';
export default () => {
const clearCache = () => {
dropByCacheKey('/list');
};
return (
<Card>
<Button onClick={clearCache}>clear list page cache</Button>
</Card>
);
};
Options
TODO
LICENSE
MIT