JSPM

  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q43935F
  • License MIT

Vue3 Hooks library

Package Exports

  • v3-use
  • v3-use/esm/index.js
  • v3-use/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 (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.

npm(tag) codecov

Install

$ npm install --save v3-use
# or
$ yarn add v3-use
# or
$ pnpm add v3-use

Usage

import { useBoolean } from 'v3-use'
const [state, { toggle, setFalse, setTrue }] = useBoolean()

Hooks

  • State

    • useState — 管理 state 的 Hook
    • useReducer — 适用于复杂状态管理的 Hook
    • useToggle — 用于在两个状态值间切换的 Hook
    • useBoolean — 管理 boolean 值的 Hook
    • useDefault — 当 state 为nullundefined时返回默认值
  • Scene

  • Browser

  • Effect

    • useTimeout — 一个可以处理 setTimeout 的 Hook
    • useInterval — 一个可以处理 setInterval 的 Hook
  • LifeCycle

    • useEffect — 方便管理生命周期的 Hook,立即运行一个函数,同时响应式地追踪其依赖,并在依赖更改时重新执行
    • useEffectOnce — 只在mountedbeforeUnmount阶段执行的生命周期
    • useFirstMountState — 检测当前是否为第一次渲染
    • useLogger — 在控制台记录 vue 生命周期变化的 Hook