프로젝트
GitHub에서 보기
alitajs/umi-plugin-keep-alive
소개
<KeepAlive> for umijs base on react-activation
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalumi-plugin-keep-alive
中文说明 | English
此 <KeepAlive> 功能基于 react-activation
在线示例
umi 多 tabs 示例:https://codesandbox.io/s/umi-keep-alive-tabs-demo-knfxy
使用方法
安装
npm install umi-plugin-keep-alive --save # or yarn add umi-plugin-keep-alive从
umi中导出KeepAlive,包裹在需要被缓存的组件上import { useState } from 'react' import { KeepAlive } from 'umi' function Counter() { const [count, setCount] = useState(0) return ( <div> <p>count: {count}</p> <button onClick={() => setCount(count => count + 1)}>add</button> </div> ) } export default function() { const [show, setShow] = useState(true) return ( <div> <h1>Page index</h1> {show && ( <KeepAlive> <Counter /> </KeepAlive> )} <button onClick={() => setShow(show => !show)}>toggle</button> </div> ) }
文档
所有来自 react-activation 都可以由 umi 导出
import {
KeepAlive,
useActivate,
useUnactivate,
withActivation,
withAliveScope,
useAliveController
} from 'umi'
访问 react-activation 查阅完整的文档
LICENSE
MIT
관련 프로젝트 살펴보기
불러오는 중…