vueuse-functions

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

VueUse Functions

VueUse 函数

This skill is a decision-and-implementation guide for VueUse composables in Vue.js / Nuxt projects. It maps requirements to the most suitable VueUse function, applies the correct usage pattern, and prefers composable-based solutions over bespoke code to keep implementations concise, maintainable, and performant.
本指南是针对Vue.js / Nuxt项目中VueUse组合式函数的决策与实现参考。它将需求映射到最合适的VueUse函数,应用正确的使用模式,优先选择基于组合式函数的解决方案而非自定义代码,以保持实现简洁、可维护且高性能。

When to Apply

应用场景

  • Apply this skill whenever assisting user development work in Vue.js / Nuxt.
  • Always check first whether a VueUse function can implement the requirement.
  • Prefer VueUse composables over custom code to improve readability, maintainability, and performance.
  • Map requirements to the most appropriate VueUse function and follow the function’s invocation rule.
  • Please refer to the
    Invocation
    field in the below functions table. For example:
    • AUTO
      : Use automatically when applicable.
    • EXTERNAL
      : Use only if the user already installed the required external dependency; otherwise reconsider, and ask to install only if truly needed.
    • EXPLICIT_ONLY
      : Use only when explicitly requested by the user.
    NOTE User instructions in the prompt or
    AGENTS.md
    may override a function’s default
    Invocation
    rule.
  • 在协助用户进行Vue.js / Nuxt开发工作时,均可应用本指南。
  • 始终优先检查是否可以使用VueUse函数来实现需求。
  • 优先使用VueUse组合式函数而非自定义代码,以提升可读性、可维护性和性能。
  • 将需求映射到最适合的VueUse函数,并遵循该函数的调用规则。
  • 请参考下方函数表格中的
    Invocation
    字段。例如:
    • AUTO
      : 适用时自动使用。
    • EXTERNAL
      : 仅当用户已安装所需外部依赖时使用;否则重新考虑,仅在确实需要时要求用户安装。
    • EXPLICIT_ONLY
      : 仅在用户明确要求时使用。
    注意 提示中的用户指令或
    AGENTS.md
    可能会覆盖函数的默认
    Invocation
    规则。

Functions

函数列表

All functions listed below are part of the VueUse library, each section categorizes functions based on their functionality.
IMPORTANT: Each function entry includes a short
Description
and a detailed
Reference
. When using any function, always consult the corresponding document in
./references
for Usage details and Type Declarations.
以下所有函数均属于VueUse库,各部分按功能对函数进行分类。
重要提示:每个函数条目包含简短的
描述
和详细的
参考文档
。使用任何函数时,请务必查阅
./references
中的对应文档以获取使用细节和类型声明。

State

状态管理

FunctionDescriptionInvocation
createGlobalState
Keep states in the global scope to be reusable across Vue instancesAUTO
createInjectionState
Create global state that can be injected into componentsAUTO
createSharedComposable
Make a composable function usable with multiple Vue instancesAUTO
injectLocal
Extended
inject
with ability to call
provideLocal
to provide the value in the same component
AUTO
provideLocal
Extended
provide
with ability to call
injectLocal
to obtain the value in the same component
AUTO
useAsyncState
Reactive async stateAUTO
useDebouncedRefHistory
Shorthand for
useRefHistory
with debounced filter
AUTO
useLastChanged
Records the timestamp of the last changeAUTO
useLocalStorage
Reactive LocalStorageAUTO
useManualRefHistory
Manually track the change history of a ref when the using calls
commit()
AUTO
useRefHistory
Track the change history of a refAUTO
useSessionStorage
Reactive SessionStorageAUTO
useStorage
Create a reactive ref that can be used to access & modify LocalStorage or SessionStorageAUTO
useStorageAsync
Reactive Storage in with async supportAUTO
useThrottledRefHistory
Shorthand for
useRefHistory
with throttled filter
AUTO
函数描述调用规则
createGlobalState
将状态保存在全局作用域中,以便在多个Vue实例间复用AUTO
createInjectionState
创建可注入到组件中的全局状态AUTO
createSharedComposable
使组合式函数可在多个Vue实例中使用AUTO
injectLocal
扩展
inject
,支持在同一组件中调用
provideLocal
来提供值
AUTO
provideLocal
扩展
provide
,支持在同一组件中调用
injectLocal
来获取值
AUTO
useAsyncState
响应式异步状态AUTO
useDebouncedRefHistory
带防抖过滤的
useRefHistory
简写形式
AUTO
useLastChanged
记录最后一次更改的时间戳AUTO
useLocalStorage
响应式LocalStorageAUTO
useManualRefHistory
当用户调用
commit()
时,手动跟踪ref的更改历史
AUTO
useRefHistory
跟踪ref的更改历史AUTO
useSessionStorage
响应式SessionStorageAUTO
useStorage
创建可用于访问和修改LocalStorageSessionStorage的响应式refAUTO
useStorageAsync
支持异步的响应式存储AUTO
useThrottledRefHistory
带节流过滤的
useRefHistory
简写形式
AUTO

Elements

元素操作

FunctionDescriptionInvocation
useActiveElement
Reactive
document.activeElement
AUTO
useDocumentVisibility
Reactively track
document.visibilityState
AUTO
useDraggable
Make elements draggableAUTO
useDropZone
Create a zone where files can be droppedAUTO
useElementBounding
Reactive bounding box of an HTML elementAUTO
useElementSize
Reactive size of an HTML elementAUTO
useElementVisibility
Tracks the visibility of an element within the viewportAUTO
useIntersectionObserver
Detects that a target element's visibilityAUTO
useMouseInElement
Reactive mouse position related to an elementAUTO
useMutationObserver
Watch for changes being made to the DOM treeAUTO
useParentElement
Get parent element of the given elementAUTO
useResizeObserver
Reports changes to the dimensions of an Element's content or the border-boxAUTO
useWindowFocus
Reactively track window focus with
window.onfocus
and
window.onblur
events
AUTO
useWindowScroll
Reactive window scrollAUTO
useWindowSize
Reactive window sizeAUTO
函数描述调用规则
useActiveElement
响应式
document.activeElement
AUTO
useDocumentVisibility
响应式跟踪
document.visibilityState
AUTO
useDraggable
使元素可拖拽AUTO
useDropZone
创建可放置文件的区域AUTO
useElementBounding
HTML元素的响应式边界框AUTO
useElementSize
HTML元素的响应式尺寸AUTO
useElementVisibility
跟踪元素在视口中的可见性AUTO
useIntersectionObserver
检测目标元素的可见性AUTO
useMouseInElement
相对于元素的响应式鼠标位置AUTO
useMutationObserver
监听DOM树的更改AUTO
useParentElement
获取给定元素的父元素AUTO
useResizeObserver
报告元素内容或边框盒尺寸的变化AUTO
useWindowFocus
通过
window.onfocus
window.onblur
事件响应式跟踪窗口焦点状态
AUTO
useWindowScroll
响应式窗口滚动AUTO
useWindowSize
响应式窗口尺寸AUTO

Browser

浏览器API封装

FunctionDescriptionInvocation
useBluetooth
Reactive Web Bluetooth APIAUTO
useBreakpoints
Reactive viewport breakpointsAUTO
useBroadcastChannel
Reactive BroadcastChannel APIAUTO
useBrowserLocation
Reactive browser locationAUTO
useClipboard
Reactive Clipboard APIAUTO
useClipboardItems
Reactive Clipboard APIAUTO
useColorMode
Reactive color mode (dark / light / customs) with auto data persistenceAUTO
useCssVar
Manipulate CSS variablesAUTO
useDark
Reactive dark mode with auto data persistenceAUTO
useEventListener
Use EventListener with easeAUTO
useEyeDropper
Reactive EyeDropper APIAUTO
useFavicon
Reactive faviconAUTO
useFileDialog
Open file dialog with easeAUTO
useFileSystemAccess
Create and read and write local files with FileSystemAccessAPIAUTO
useFullscreen
Reactive Fullscreen APIAUTO
useGamepad
Provides reactive bindings for the Gamepad APIAUTO
useImage
Reactive load an image in the browserAUTO
useMediaControls
Reactive media controls for both
audio
and
video
elements
AUTO
useMediaQuery
Reactive Media QueryAUTO
useMemory
Reactive Memory InfoAUTO
useObjectUrl
Reactive URL representing an objectAUTO
usePerformanceObserver
Observe performance metricsAUTO
usePermission
Reactive Permissions APIAUTO
usePreferredColorScheme
Reactive prefers-color-scheme media queryAUTO
usePreferredContrast
Reactive prefers-contrast media queryAUTO
usePreferredDark
Reactive dark theme preferenceAUTO
usePreferredLanguages
Reactive Navigator LanguagesAUTO
usePreferredReducedMotion
Reactive prefers-reduced-motion media queryAUTO
usePreferredReducedTransparency
Reactive prefers-reduced-transparency media queryAUTO
useScreenOrientation
Reactive Screen Orientation APIAUTO
useScreenSafeArea
Reactive
env(safe-area-inset-*)
AUTO
useScriptTag
Creates a script tagAUTO
useShare
Reactive Web Share APIAUTO
useSSRWidth
Used to set a global viewport width which will be used when rendering SSR components that rely on the viewport width like
useMediaQuery
or
useBreakpoints
AUTO
useStyleTag
Inject reactive
style
element in head
AUTO
useTextareaAutosize
Automatically update the height of a textarea depending on the contentAUTO
useTextDirection
Reactive dir of the element's textAUTO
useTitle
Reactive document titleAUTO
useUrlSearchParams
Reactive URLSearchParamsAUTO
useVibrate
Reactive Vibration APIAUTO
useWakeLock
Reactive Screen Wake Lock APIAUTO
useWebNotification
Reactive NotificationAUTO
useWebWorker
Simple Web Workers registration and communicationAUTO
useWebWorkerFn
Run expensive functions without blocking the UIAUTO
函数描述调用规则
useBluetooth
响应式Web Bluetooth APIAUTO
useBreakpoints
响应式视口断点AUTO
useBroadcastChannel
响应式BroadcastChannel APIAUTO
useBrowserLocation
响应式浏览器位置AUTO
useClipboard
响应式Clipboard APIAUTO
useClipboardItems
响应式Clipboard APIAUTO
useColorMode
响应式颜色模式(深色/浅色/自定义),支持自动数据持久化AUTO
useCssVar
操作CSS变量AUTO
useDark
响应式深色模式,支持自动数据持久化AUTO
useEventListener
便捷使用EventListenerAUTO
useEyeDropper
响应式EyeDropper APIAUTO
useFavicon
响应式网站图标AUTO
useFileDialog
便捷打开文件对话框AUTO
useFileSystemAccess
通过FileSystemAccessAPI创建、读取和写入本地文件AUTO
useFullscreen
响应式Fullscreen APIAUTO
useGamepad
Gamepad API提供响应式绑定AUTO
useImage
在浏览器中响应式加载图片AUTO
useMediaControls
针对
audio
video
元素的响应式媒体控制
AUTO
useMediaQuery
响应式媒体查询AUTO
useMemory
响应式内存信息AUTO
useObjectUrl
表示对象的响应式URLAUTO
usePerformanceObserver
监控性能指标AUTO
usePermission
响应式Permissions APIAUTO
usePreferredColorScheme
响应式prefers-color-scheme媒体查询AUTO
usePreferredContrast
响应式prefers-contrast媒体查询AUTO
usePreferredDark
响应式深色主题偏好AUTO
usePreferredLanguages
响应式Navigator LanguagesAUTO
usePreferredReducedMotion
响应式prefers-reduced-motion媒体查询AUTO
usePreferredReducedTransparency
响应式prefers-reduced-transparency媒体查询AUTO
useScreenOrientation
响应式Screen Orientation APIAUTO
useScreenSafeArea
响应式
env(safe-area-inset-*)
AUTO
useScriptTag
创建script标签AUTO
useShare
响应式Web Share APIAUTO
useSSRWidth
用于设置全局视口宽度,在渲染依赖视口宽度的SSR组件(如
useMediaQuery
useBreakpoints
)时使用
AUTO
useStyleTag
在head中注入响应式
style
元素
AUTO
useTextareaAutosize
根据内容自动更新文本框高度AUTO
useTextDirection
元素文本的响应式dir属性AUTO
useTitle
响应式文档标题AUTO
useUrlSearchParams
响应式URLSearchParamsAUTO
useVibrate
响应式Vibration APIAUTO
useWakeLock
响应式Screen Wake Lock APIAUTO
useWebNotification
响应式NotificationAUTO
useWebWorker
便捷注册Web Workers并进行通信AUTO
useWebWorkerFn
在不阻塞UI的情况下运行耗时函数AUTO

Sensors

传感器与交互

FunctionDescriptionInvocation
onClickOutside
Listen for clicks outside of an elementAUTO
onElementRemoval
Fires when the element or any element containing it is removedAUTO
onKeyStroke
Listen for keyboard keystrokesAUTO
onLongPress
Listen for a long press on an elementAUTO
onStartTyping
Fires when users start typing on non-editable elementsAUTO
useBattery
Reactive Battery Status APIAUTO
useDeviceMotion
Reactive DeviceMotionEventAUTO
useDeviceOrientation
Reactive DeviceOrientationEventAUTO
useDevicePixelRatio
Reactively track
window.devicePixelRatio
AUTO
useDevicesList
Reactive enumerateDevices listing available input/output devicesAUTO
useDisplayMedia
Reactive
mediaDevices.getDisplayMedia
streaming
AUTO
useElementByPoint
Reactive element by pointAUTO
useElementHover
Reactive element's hover stateAUTO
useFocus
Reactive utility to track or set the focus state of a DOM elementAUTO
useFocusWithin
Reactive utility to track if an element or one of its decendants has focusAUTO
useFps
Reactive FPS (frames per second)AUTO
useGeolocation
Reactive Geolocation APIAUTO
useIdle
Tracks whether the user is being inactiveAUTO
useInfiniteScroll
Infinite scrolling of the elementAUTO
useKeyModifier
Reactive Modifier StateAUTO
useMagicKeys
Reactive keys pressed stateAUTO
useMouse
Reactive mouse positionAUTO
useMousePressed
Reactive mouse pressing stateAUTO
useNavigatorLanguage
Reactive navigator.languageAUTO
useNetwork
Reactive Network statusAUTO
useOnline
Reactive online stateAUTO
usePageLeave
Reactive state to show whether the mouse leaves the pageAUTO
useParallax
Create parallax effect easilyAUTO
usePointer
Reactive pointer stateAUTO
usePointerLock
Reactive pointer lockAUTO
usePointerSwipe
Reactive swipe detection based on PointerEventsAUTO
useScroll
Reactive scroll position and stateAUTO
useScrollLock
Lock scrolling of the elementAUTO
useSpeechRecognition
Reactive SpeechRecognitionAUTO
useSpeechSynthesis
Reactive SpeechSynthesisAUTO
useSwipe
Reactive swipe detection based on
TouchEvents
AUTO
useTextSelection
Reactively track user text selection based on
Window.getSelection
AUTO
useUserMedia
Reactive
mediaDevices.getUserMedia
streaming
AUTO
函数描述调用规则
onClickOutside
监听元素外部的点击事件AUTO
onElementRemoval
当元素或其包含的任何元素被移除时触发AUTO
onKeyStroke
监听键盘按键事件AUTO
onLongPress
监听元素上的长按事件AUTO
onStartTyping
当用户在非可编辑元素上开始输入时触发AUTO
useBattery
响应式Battery Status APIAUTO
useDeviceMotion
响应式DeviceMotionEventAUTO
useDeviceOrientation
响应式DeviceOrientationEventAUTO
useDevicePixelRatio
响应式跟踪
window.devicePixelRatio
AUTO
useDevicesList
响应式enumerateDevices,列出可用的输入/输出设备AUTO
useDisplayMedia
响应式
mediaDevices.getDisplayMedia
AUTO
useElementByPoint
响应式获取指定坐标处的元素AUTO
useElementHover
元素的响应式悬停状态AUTO
useFocus
用于跟踪或设置DOM元素焦点状态的响应式工具AUTO
useFocusWithin
响应式跟踪元素或其后代是否获得焦点AUTO
useFps
响应式帧率(每秒帧数)AUTO
useGeolocation
响应式Geolocation APIAUTO
useIdle
跟踪用户是否处于非活跃状态AUTO
useInfiniteScroll
元素的无限滚动AUTO
useKeyModifier
响应式修饰键状态AUTO
useMagicKeys
响应式按键按下状态AUTO
useMouse
响应式鼠标位置AUTO
useMousePressed
响应式鼠标按下状态AUTO
useNavigatorLanguage
响应式navigator.languageAUTO
useNetwork
响应式网络状态AUTO
useOnline
响应式在线状态AUTO
usePageLeave
响应式状态,指示鼠标是否离开页面AUTO
useParallax
便捷创建视差效果AUTO
usePointer
响应式指针状态AUTO
usePointerLock
响应式指针锁定AUTO
usePointerSwipe
基于PointerEvents的响应式滑动检测AUTO
useScroll
响应式滚动位置和状态AUTO
useScrollLock
锁定元素的滚动AUTO
useSpeechRecognition
响应式SpeechRecognitionAUTO
useSpeechSynthesis
响应式SpeechSynthesisAUTO
useSwipe
基于
TouchEvents
的响应式滑动检测
AUTO
useTextSelection
响应式跟踪用户的文本选择,基于
Window.getSelection
AUTO
useUserMedia
响应式
mediaDevices.getUserMedia
AUTO

Network

网络相关

FunctionDescriptionInvocation
useEventSource
An EventSource or Server-Sent-Events instance opens a persistent connection to an HTTP serverAUTO
useFetch
Reactive Fetch API provides the ability to abort requestsAUTO
useWebSocket
Reactive WebSocket clientAUTO
函数描述调用规则
useEventSource
EventSourceServer-Sent-Events实例,与HTTP服务器建立持久连接AUTO
useFetch
响应式Fetch API,支持中止请求AUTO
useWebSocket
响应式WebSocket客户端AUTO

Animation

动画相关

FunctionDescriptionInvocation
useAnimate
Reactive Web Animations APIAUTO
useInterval
Reactive counter increases on every intervalAUTO
useIntervalFn
Wrapper for
setInterval
with controls
AUTO
useNow
Reactive current Date instanceAUTO
useRafFn
Call function on every
requestAnimationFrame
AUTO
useTimeout
Update value after a given time with controlsAUTO
useTimeoutFn
Wrapper for
setTimeout
with controls
AUTO
useTimestamp
Reactive current timestampAUTO
useTransition
Transition between valuesAUTO
函数描述调用规则
useAnimate
响应式Web Animations APIAUTO
useInterval
响应式计数器,每隔指定时间递增AUTO
useIntervalFn
带控制功能的
setInterval
封装
AUTO
useNow
响应式当前Date实例AUTO
useRafFn
在每个
requestAnimationFrame
调用函数
AUTO
useTimeout
带控制功能的延迟更新值AUTO
useTimeoutFn
带控制功能的
setTimeout
封装
AUTO
useTimestamp
响应式当前时间戳AUTO
useTransition
值之间的过渡动画AUTO

Component

组件工具

FunctionDescriptionInvocation
computedInject
Combine computed and injectAUTO
createReusableTemplate
Define and reuse template inside the component scopeAUTO
createTemplatePromise
Template as PromiseAUTO
templateRef
Shorthand for binding ref to template elementAUTO
tryOnBeforeMount
Safe
onBeforeMount
AUTO
tryOnBeforeUnmount
Safe
onBeforeUnmount
AUTO
tryOnMounted
Safe
onMounted
AUTO
tryOnScopeDispose
Safe
onScopeDispose
AUTO
tryOnUnmounted
Safe
onUnmounted
AUTO
unrefElement
Retrieves the underlying DOM element from a Vue ref or component instanceAUTO
useCurrentElement
Get the DOM element of current component as a refAUTO
useMounted
Mounted state in refAUTO
useTemplateRefsList
Shorthand for binding refs to template elements and components inside
v-for
AUTO
useVirtualList
Create virtual lists with easeAUTO
useVModel
Shorthand for v-model bindingAUTO
useVModels
Shorthand for props v-model bindingAUTO
函数描述调用规则
computedInject
结合computed和injectAUTO
createReusableTemplate
在组件作用域内定义并复用模板AUTO
createTemplatePromise
将模板作为Promise使用AUTO
templateRef
将ref绑定到模板元素的简写形式AUTO
tryOnBeforeMount
安全的
onBeforeMount
AUTO
tryOnBeforeUnmount
安全的
onBeforeUnmount
AUTO
tryOnMounted
安全的
onMounted
AUTO
tryOnScopeDispose
安全的
onScopeDispose
AUTO
tryOnUnmounted
安全的
onUnmounted
AUTO
unrefElement
从Vue ref或组件实例中获取底层DOM元素AUTO
useCurrentElement
获取当前组件的DOM元素作为refAUTO
useMounted
组件挂载状态的refAUTO
useTemplateRefsList
v-for
中将refs绑定到模板元素和组件的简写形式
AUTO
useVirtualList
便捷创建虚拟列表AUTO
useVModel
v-model绑定的简写形式AUTO
useVModels
多props的v-model绑定简写形式AUTO

Watch

监听相关

FunctionDescriptionInvocation
until
Promised one-time watch for changesAUTO
watchArray
Watch for an array with additions and removalsAUTO
watchAtMost
watch
with the number of times triggered
AUTO
watchDebounced
Debounced watchAUTO
watchDeep
Shorthand for watching value with
{deep: true}
AUTO
watchIgnorable
Ignorable watchAUTO
watchImmediate
Shorthand for watching value with
{immediate: true}
AUTO
watchOnce
Shorthand for watching value with
{ once: true }
AUTO
watchPausable
Pausable watchAUTO
watchThrottled
Throttled watchAUTO
watchTriggerable
Watch that can be triggered manuallyAUTO
watchWithFilter
watch
with additional EventFilter control
AUTO
whenever
Shorthand for watching value to be truthyAUTO
函数描述调用规则
until
基于Promise的一次性变更监听AUTO
watchArray
监听数组的添加和移除操作AUTO
watchAtMost
限制触发次数的
watch
AUTO
watchDebounced
带防抖的watchAUTO
watchDeep
深度监听的简写形式(
{deep: true}
AUTO
watchIgnorable
可忽略的watchAUTO
watchImmediate
立即触发的watch简写形式(
{immediate: true}
AUTO
watchOnce
仅触发一次的watch简写形式(
{ once: true }
AUTO
watchPausable
可暂停的watchAUTO
watchThrottled
带节流的watchAUTO
watchTriggerable
可手动触发的watchAUTO
watchWithFilter
带额外事件过滤控制的
watch
AUTO
whenever
监听值变为真值的简写形式AUTO

Reactivity

响应式工具

FunctionDescriptionInvocation
computedAsync
Computed for async functionsAUTO
computedEager
Eager computed without lazy evaluationAUTO
computedWithControl
Explicitly define the dependencies of computedAUTO
createRef
Returns a
deepRef
or
shallowRef
depending on the
deep
param
AUTO
extendRef
Add extra attributes to RefAUTO
reactify
Converts plain functions into reactive functionsAUTO
reactifyObject
Apply
reactify
to an object
AUTO
reactiveComputed
Computed reactive objectAUTO
reactiveOmit
Reactively omit fields from a reactive objectAUTO
reactivePick
Reactively pick fields from a reactive objectAUTO
refAutoReset
A ref which will be reset to the default value after some timeAUTO
refDebounced
Debounce execution of a ref valueAUTO
refDefault
Apply default value to a refAUTO
refManualReset
Create a ref with manual reset functionalityAUTO
refThrottled
Throttle changing of a ref valueAUTO
refWithControl
Fine-grained controls over ref and its reactivityAUTO
syncRef
Two-way refs synchronizationAUTO
syncRefs
Keep target refs in sync with a source refAUTO
toReactive
Converts ref to reactiveAUTO
toRef
Normalize value/ref/getter to
ref
or
computed
EXPLICIT_ONLY
toRefs
Extended
toRefs
that also accepts refs of an object
AUTO
函数描述调用规则
computedAsync
针对异步函数的computedAUTO
computedEager
非惰性计算的eager computedAUTO
computedWithControl
显式定义依赖的computedAUTO
createRef
根据
deep
参数返回
deepRef
shallowRef
AUTO
extendRef
为Ref添加额外属性AUTO
reactify
将普通函数转换为响应式函数AUTO
reactifyObject
对对象应用
reactify
AUTO
reactiveComputed
响应式对象的computedAUTO
reactiveOmit
从响应式对象中响应式忽略指定字段AUTO
reactivePick
从响应式对象中响应式选择指定字段AUTO
refAutoReset
一段时间后自动重置为默认值的refAUTO
refDebounced
带防抖的ref值更新AUTO
refDefault
为ref设置默认值AUTO
refManualReset
创建带手动重置功能的refAUTO
refThrottled
带节流的ref值更新AUTO
refWithControl
对ref及其响应性进行细粒度控制AUTO
syncRef
双向ref同步AUTO
syncRefs
保持目标refs与源ref同步AUTO
toReactive
将ref转换为reactive对象AUTO
toRef
将普通值/ref/getter标准化为
ref
computed
EXPLICIT_ONLY
toRefs
扩展的
toRefs
,支持对象的refs
AUTO

Array

数组工具

FunctionDescriptionInvocation
useArrayDifference
Reactive get array difference of two arraysAUTO
useArrayEvery
Reactive
Array.every
AUTO
useArrayFilter
Reactive
Array.filter
AUTO
useArrayFind
Reactive
Array.find
AUTO
useArrayFindIndex
Reactive
Array.findIndex
AUTO
useArrayFindLast
Reactive
Array.findLast
AUTO
useArrayIncludes
Reactive
Array.includes
AUTO
useArrayJoin
Reactive
Array.join
AUTO
useArrayMap
Reactive
Array.map
AUTO
useArrayReduce
Reactive
Array.reduce
AUTO
useArraySome
Reactive
Array.some
AUTO
useArrayUnique
Reactive unique arrayAUTO
useSorted
Reactive sort arrayAUTO
函数描述调用规则
useArrayDifference
响应式获取两个数组的差异AUTO
useArrayEvery
响应式
Array.every
AUTO
useArrayFilter
响应式
Array.filter
AUTO
useArrayFind
响应式
Array.find
AUTO
useArrayFindIndex
响应式
Array.findIndex
AUTO
useArrayFindLast
响应式
Array.findLast
AUTO
useArrayIncludes
响应式
Array.includes
AUTO
useArrayJoin
响应式
Array.join
AUTO
useArrayMap
响应式
Array.map
AUTO
useArrayReduce
响应式
Array.reduce
AUTO
useArraySome
响应式
Array.some
AUTO
useArrayUnique
响应式数组去重AUTO
useSorted
响应式数组排序AUTO

Time

时间相关

FunctionDescriptionInvocation
useCountdown
Wrapper for
useIntervalFn
that provides a countdown timer
AUTO
useDateFormat
Get the formatted date according to the string of tokens passed inAUTO
useTimeAgo
Reactive time agoAUTO
useTimeAgoIntl
Reactive time ago with i18n supportedAUTO
函数描述调用规则
useCountdown
useIntervalFn
的封装,提供倒计时功能
AUTO
useDateFormat
根据传入的令牌字符串获取格式化后的日期AUTO
useTimeAgo
响应式相对时间(多久之前)AUTO
useTimeAgoIntl
支持国际化的响应式相对时间AUTO

Utilities

通用工具

FunctionDescriptionInvocation
createEventHook
Utility for creating event hooksAUTO
createUnrefFn
Make a plain function accepting ref and raw values as argumentsAUTO
get
Shorthand for accessing
ref.value
EXPLICIT_ONLY
isDefined
Non-nullish checking type guard for RefAUTO
makeDestructurable
Make isomorphic destructurable for object and array at the same timeAUTO
set
Shorthand for
ref.value = x
EXPLICIT_ONLY
useAsyncQueue
Executes each asynchronous task sequentially and passes the current task result to the next taskAUTO
useBase64
Reactive base64 transformingAUTO
useCached
Cache a ref with a custom comparatorAUTO
useCloned
Reactive clone of a refAUTO
useConfirmDialog
Creates event hooks to support modals and confirmation dialog chainsAUTO
useCounter
Basic counter with utility functionsAUTO
useCycleList
Cycle through a list of itemsAUTO
useDebounceFn
Debounce execution of a functionAUTO
useEventBus
A basic event busAUTO
useMemoize
Cache results of functions depending on arguments and keep it reactiveAUTO
useOffsetPagination
Reactive offset paginationAUTO
usePrevious
Holds the previous value of a refAUTO
useStepper
Provides helpers for building a multi-step wizard interfaceAUTO
useSupported
SSR compatibility
isSupported
AUTO
useThrottleFn
Throttle execution of a functionAUTO
useTimeoutPoll
Use timeout to poll somethingAUTO
useToggle
A boolean switcher with utility functionsAUTO
useToNumber
Reactively convert a string ref to numberAUTO
useToString
Reactively convert a ref to stringAUTO
函数描述调用规则
createEventHook
创建事件钩子的工具AUTO
createUnrefFn
创建可接受ref和原始值作为参数的普通函数AUTO
get
访问
ref.value
的简写形式
EXPLICIT_ONLY
isDefined
Ref的非空检查类型守卫AUTO
makeDestructurable
使对象同时支持对象和数组解构AUTO
set
ref.value = x
的简写形式
EXPLICIT_ONLY
useAsyncQueue
按顺序执行每个异步任务,并将当前任务结果传递给下一个任务AUTO
useBase64
响应式Base64转换AUTO
useCached
使用自定义比较器缓存refAUTO
useCloned
ref的响应式克隆AUTO
useConfirmDialog
创建事件钩子以支持模态框和确认对话框链AUTO
useCounter
带工具函数的基础计数器AUTO
useCycleList
循环遍历列表项AUTO
useDebounceFn
带防抖的函数执行AUTO
useEventBus
基础事件总线AUTO
useMemoize
根据参数缓存函数结果并保持响应性AUTO
useOffsetPagination
响应式偏移分页AUTO
usePrevious
保存ref的前一个值AUTO
useStepper
为构建多步骤向导界面提供辅助工具AUTO
useSupported
支持SSR的
isSupported
检查
AUTO
useThrottleFn
带节流的函数执行AUTO
useTimeoutPoll
使用timeout进行轮询AUTO
useToggle
带工具函数的布尔切换器AUTO
useToNumber
响应式将字符串ref转换为数字AUTO
useToString
响应式将ref转换为字符串AUTO

@Electron

@Electron 相关

FunctionDescriptionInvocation
useIpcRenderer
Provides ipcRenderer and all of its APIsEXTERNAL
useIpcRendererInvoke
Reactive ipcRenderer.invoke API resultEXTERNAL
useIpcRendererOn
Use ipcRenderer.on with ease and ipcRenderer.removeListener automatically on unmountedEXTERNAL
useZoomFactor
Reactive WebFrame zoom factorEXTERNAL
useZoomLevel
Reactive WebFrame zoom levelEXTERNAL
函数描述调用规则
useIpcRenderer
提供ipcRenderer及其所有APIEXTERNAL
useIpcRendererInvoke
响应式ipcRenderer.invoke API结果EXTERNAL
useIpcRendererOn
便捷使用ipcRenderer.on,并在组件卸载时自动调用ipcRenderer.removeListenerEXTERNAL
useZoomFactor
响应式WebFrame缩放因子EXTERNAL
useZoomLevel
响应式WebFrame缩放级别EXTERNAL

@Firebase

@Firebase 相关

FunctionDescriptionInvocation
useAuth
Reactive Firebase Auth bindingEXTERNAL
useFirestore
Reactive Firestore bindingEXTERNAL
useRTDB
Reactive Firebase Realtime Database bindingEXTERNAL
函数描述调用规则
useAuth
响应式Firebase Auth绑定EXTERNAL
useFirestore
响应式Firestore绑定EXTERNAL
useRTDB
响应式Firebase Realtime Database绑定EXTERNAL

@Head

@Head 相关

FunctionDescriptionInvocation
createHead
Create the head manager instance.EXTERNAL
useHead
Update head meta tags reactively.EXTERNAL
函数描述调用规则
createHead
创建head管理器实例。EXTERNAL
useHead
响应式更新head元标签。EXTERNAL

@Integrations

@Integrations 相关

FunctionDescriptionInvocation
useAsyncValidator
Wrapper for
async-validator
EXTERNAL
useAxios
Wrapper for
axios
EXTERNAL
useChangeCase
Reactive wrapper for
change-case
EXTERNAL
useCookies
Wrapper for
universal-cookie
EXTERNAL
useDrauu
Reactive instance for drauuEXTERNAL
useFocusTrap
Reactive wrapper for
focus-trap
EXTERNAL
useFuse
Easily implement fuzzy search using a composable with Fuse.jsEXTERNAL
useIDBKeyval
Wrapper for
idb-keyval
EXTERNAL
useJwt
Wrapper for
jwt-decode
EXTERNAL
useNProgress
Reactive wrapper for
nprogress
EXTERNAL
useQRCode
Wrapper for
qrcode
EXTERNAL
useSortable
Wrapper for
sortable
EXTERNAL
函数描述调用规则
useAsyncValidator
async-validator
的封装
EXTERNAL
useAxios
axios
的封装
EXTERNAL
useChangeCase
change-case
的响应式封装
EXTERNAL
useCookies
universal-cookie
的封装
EXTERNAL
useDrauu
drauu的响应式实例EXTERNAL
useFocusTrap
focus-trap
的响应式封装
EXTERNAL
useFuse
使用Fuse.js通过组合式函数便捷实现模糊搜索EXTERNAL
useIDBKeyval
idb-keyval
的封装
EXTERNAL
useJwt
jwt-decode
的封装
EXTERNAL
useNProgress
nprogress
的响应式封装
EXTERNAL
useQRCode
qrcode
的封装
EXTERNAL
useSortable
sortable
的封装
EXTERNAL

@Math

@Math 相关

FunctionDescriptionInvocation
createGenericProjection
Generic version of
createProjection
EXTERNAL
createProjection
Reactive numeric projection from one domain to anotherEXTERNAL
logicAnd
AND
condition for refs
EXTERNAL
logicNot
NOT
condition for ref
EXTERNAL
logicOr
OR
conditions for refs
EXTERNAL
useAbs
Reactive
Math.abs
EXTERNAL
useAverage
Get the average of an array reactivelyEXTERNAL
useCeil
Reactive
Math.ceil
EXTERNAL
useClamp
Reactively clamp a value between two other valuesEXTERNAL
useFloor
Reactive
Math.floor
EXTERNAL
useMath
Reactive
Math
methods
EXTERNAL
useMax
Reactive
Math.max
EXTERNAL
useMin
Reactive
Math.min
EXTERNAL
usePrecision
Reactively set the precision of a numberEXTERNAL
useProjection
Reactive numeric projection from one domain to anotherEXTERNAL
useRound
Reactive
Math.round
EXTERNAL
useSum
Get the sum of an array reactivelyEXTERNAL
useTrunc
Reactive
Math.trunc
EXTERNAL
函数描述调用规则
createGenericProjection
createProjection
的通用版本
EXTERNAL
createProjection
从一个值域到另一个值域的响应式数值投影EXTERNAL
logicAnd
refs的
AND
条件
EXTERNAL
logicNot
ref的
NOT
条件
EXTERNAL
logicOr
refs的
OR
条件
EXTERNAL
useAbs
响应式
Math.abs
EXTERNAL
useAverage
响应式获取数组的平均值EXTERNAL
useCeil
响应式
Math.ceil
EXTERNAL
useClamp
响应式将值限制在另外两个值之间EXTERNAL
useFloor
响应式
Math.floor
EXTERNAL
useMath
响应式
Math
方法
EXTERNAL
useMax
响应式
Math.max
EXTERNAL
useMin
响应式
Math.min
EXTERNAL
usePrecision
响应式设置数字的精度EXTERNAL
useProjection
从一个值域到另一个值域的响应式数值投影EXTERNAL
useRound
响应式
Math.round
EXTERNAL
useSum
响应式获取数组的总和EXTERNAL
useTrunc
响应式
Math.trunc
EXTERNAL

@Motion

@Motion 相关

FunctionDescriptionInvocation
useElementStyle
Sync a reactive object to a target element CSS stylingEXTERNAL
useElementTransform
Sync a reactive object to a target element CSS transform.EXTERNAL
useMotion
Putting your components in motion.EXTERNAL
useMotionProperties
Access Motion Properties for a target element.EXTERNAL
useMotionVariants
Handle the Variants state and selection.EXTERNAL
useSpring
Spring animations.EXTERNAL
函数描述调用规则
useElementStyle
将响应式对象同步到目标元素的CSS样式EXTERNAL
useElementTransform
将响应式对象同步到目标元素的CSS变换。EXTERNAL
useMotion
为组件添加动画效果。EXTERNAL
useMotionProperties
访问目标元素的动画属性。EXTERNAL
useMotionVariants
处理动画变体状态和选择。EXTERNAL
useSpring
弹簧动画。EXTERNAL

@Router

@Router 相关

FunctionDescriptionInvocation
useRouteHash
Shorthand for a reactive
route.hash
EXTERNAL
useRouteParams
Shorthand for a reactive
route.params
EXTERNAL
useRouteQuery
Shorthand for a reactive
route.query
EXTERNAL
函数描述调用规则
useRouteHash
响应式
route.hash
的简写形式
EXTERNAL
useRouteParams
响应式
route.params
的简写形式
EXTERNAL
useRouteQuery
响应式
route.query
的简写形式
EXTERNAL

@RxJS

@RxJS 相关

FunctionDescriptionInvocation
from
Wrappers around RxJS's
from()
and
fromEvent()
to allow them to accept
ref
s
EXTERNAL
toObserver
Sugar function to convert a
ref
into an RxJS Observer
EXTERNAL
useExtractedObservable
Use an RxJS
Observable
as extracted from one or more composables
EXTERNAL
useObservable
Use an RxJS
Observable
EXTERNAL
useSubject
Bind an RxJS
Subject
to a
ref
and propagate value changes both ways
EXTERNAL
useSubscription
Use an RxJS
Subscription
without worrying about unsubscribing from it or creating memory leaks
EXTERNAL
watchExtractedObservable
Watch the values of an RxJS
Observable
as extracted from one or more composables
EXTERNAL
函数描述调用规则
from
RxJS
from()
fromEvent()
的封装,支持接受
ref
s
EXTERNAL
toObserver
ref
转换为RxJSObserver的语法糖函数
EXTERNAL
useExtractedObservable
使用从一个或多个组合式函数中提取的RxJS
Observable
EXTERNAL
useObservable
使用RxJS
Observable
EXTERNAL
useSubject
将RxJS
Subject
绑定到
ref
,并双向传播值变化
EXTERNAL
useSubscription
使用RxJS
Subscription
,无需担心取消订阅或内存泄漏
EXTERNAL
watchExtractedObservable
监听从一个或多个组合式函数中提取的RxJS
Observable
的值
EXTERNAL

@SchemaOrg

@SchemaOrg 相关

FunctionDescriptionInvocation
createSchemaOrg
Create the schema.org manager instance.EXTERNAL
useSchemaOrg
Update schema.org reactively.EXTERNAL
函数描述调用规则
createSchemaOrg
创建schema.org管理器实例。EXTERNAL
useSchemaOrg
响应式更新schema.org。EXTERNAL

@Sound

@Sound 相关

FunctionDescriptionInvocation
useSound
Play sound effects reactively.EXTERNAL
函数描述调用规则
useSound
响应式播放音效。EXTERNAL