Package Exports
- v3-use
- v3-use/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (v3-use) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
v3-use
v3-use is a high-quality and reliable Vue3 Hooks library. Using vue3.x composition api in react-hooks style.
Install
npm install v3-use
Usage
import { useBoolean } from 'v3-use'
const [state, { toggle, setFalse, setTrue }] = useBoolean()
Hooks
State
useState
— 管理 state 的 HookuseReducer
— 适用于复杂状态管理的 HookuseToggle
— 用于在两个状态值间切换的 HookuseBoolean
— 管理 boolean 值的 HookuseFirstMountState
— 检测当前是否为第一次渲染(onMounted)
Scene
useCounter
— 管理计数器的 HookuseMethods
— 一个 useReducer 简化版的 HookuseCountDown
— 一个用于管理倒计时的 Hook
Dom
useTitle
— 用于设置页面标题
Effect
useTimeout
— 一个可以处理 setTimeout 的 HookuseInterval
— 一个可以处理 setInterval 的 Hook
LifeCycle
useEffect
— 像 React 一样使用 useEffect 的 HookuseEffectOnce
— 只在mounted
、beforeUnmount
阶段执行的生命周期useUpdateEffect
— onUpdated 钩子函数封装,支持传入依赖监听useLogger
— 在控制台记录经历的生命周期(mounted,updated,breforeUnmount)