VueUse
VueUse 是一个包含 100 多个 Vue 组合式函数的集合。代码简洁,易于阅读和理解。值得学习,就按官网顺序列举了,有时间慢慢敲一遍
State
✔️ createGlobalState
createInjectionState
createSharedComposable
useAsyncState
useDebouncedRefHistory
useLastChanged
useLocalStorage
useManualRefHistory
useRefHistory
useSessionStorage
useStorage
useStorageAsync
useThrottledRefHistory
Elements
useActiveElement
useDocumentVisibility
useDraggable
useDropZone
useElementBounding
useElementSize
useElementVisibility
useIntersectionObserver
useMouseInElement
useMutationObserver
useResizeObserver
useWindowFocus
useWindowScroll
useWindowSize
Browser
useBluetooth
useBreakpoints
useBroadcastChannel
useBrowserLocation
useClipboard
useColorMode
useCssVar
useDark
useEventListener
useEyeDropper
useFavicon
useFileDialog
useFileSystemAccess
useFullscreen
useGamepad
✔️ useImage
useMediaControls
useMediaQuery
useMemory
useObjectUrl
usePermission
usePreferredColorScheme
usePreferredContrast
usePreferredDark
usePreferredLanguages
usePreferredReducedMotion
useScreenOrientation
useScreenSafeArea
useScriptTag
useShare
useStyleTag
useTextareaAutosize
useTextDirection
useTitle
useUrlSearchParams
useVibrate
useWakeLock
useWebNotification
useWebWorker
useWebWorkerFn
Sensors
onClickOutside
onKeyStroke
onLongPress
onStartTyping
useBattery
useDeviceMotion
useDeviceOrientation
useDevicePixelRatio
useDevicesList
useDisplayMedia
useElementByPoint
useElementHover
useFocus
useFocusWithin
useFps
useGeolocation
useIdle
useInfiniteScroll
useKeyModifier
useMagicKeys
useMouse
useMousePressed
useNavigatorLanguage
useNetwork
useOnline
usePageLeave
useParallax
usePointer
usePointerLock
usePointerSwipe
useScroll
useScrollLock
useSpeechRecognition
useSpeechSynthesis
useSwipe
useTextSelection
useUserMedia
Network
useEventSource
useFetch
useWebSocket
Animation
useInterval
useIntervalFn
useNow
useRafFn
useTimeout
useTimeoutFn
useTimestamp
useTransition
Component
computedInject
templateRef
tryOnBeforeMount
tryOnBeforeUnmount
tryOnMounted
tryOnScopeDispose
tryOnUnmounted
unrefElement
useCurrentElement
useMounted
useTemplateRefsList
useVirtualList
useVModel
useVModels
Watch
until
watchArray
watchAtMost
watchDebounced
watchIgnorable
watchOnce
watchPausable
watchThrottled
watchTriggerable
watchWithFilter
whenever
Reactivity
computedAsync
computedEager
computedWithControl
extendRef
reactify
reactifyObject
reactiveComputed
reactiveOmit
reactivePick
refAutoReset
refDebounced
refDefault
refThrottled
refWithControl
resolveRef
resolveUnref
syncRef
syncRefs
toReactive
toRefs
Array
useArrayEvery
useArrayFilter
useArrayFind
useArrayFindIndex
useArrayFindLast
useArrayJoin
useArrayMap
useArrayReduce
useArraySome
useArrayUnique
useSorted
Time
useDateFormat
useTimeAgo
Utilities
createEventHook
createUnrefFn
get
isDefined
makeDestructurable
set
useAsyncQueue
useBase64
useCached
useCloned
useConfirmDialog
useCounter
useCycleList
useDebounceFn
useEventBus
useMemoize
useOffsetPagination
usePrevious
useStepper
useSupported
useThrottleFn
useTimeoutPoll
useToggle
useToNumber
useToString