Package Exports
- vue-uses
- vue-uses/esm/index.js
- vue-uses/lib/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 (vue-uses) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vue-uses
A Hooks Library for Vue3 and 2
English | 简体中文
Install
$ npm install --save vue-uses
# or
$ yarn add vue-uses
# or
$ pnpm add vue-usesUsage
import { useBoolean } from 'vue-uses'
const [state, { toggle, setFalse, setTrue }] = useBoolean()Hooks
State
useState— managing state.useReducer— complex state management.useToggle— toggling between two states.useBoolean— managing boolean values.
Scene
useCounter— managing counters.useMethods— A simplified version ofuseReducer.useCountDown— managing countdowns.usePolling— managing polling.
Effect
useTimeout— handlingsetTimeout.useInterval— handlingsetInterval.
LifeCycle
useEffect— conveniently managing component lifecycle, running a function immediately, tracking its dependencies reactively, and re-executing when dependencies change.useEffectOnce— a lifecycle function only during themountedandbeforeUnmountphases.useFirstMountState— detecting whether the current render is the first render.useLogger— logging Vue lifecycle changes to the console.