url stringlengths 24 106 | html stringlengths 41 53k | title stringlengths 0 63 |
|---|---|---|
https://vueuse.org/shared/watchDeep/#VPContent | watchDeep
Category
Watch
Export Size
325 B
Last Changed
7 months ago
Shorthand for watching value with {deep: true}
Usage
Similar to watch, but with { deep: true }
ts
import { watchDeep } from '@vueuse/core'
const nestedObject = ref({ foo: { bar: { deep: 5 } } })
watchDeep(nestedObject, (obj) => {
console.l... | watchDeep | VueUse |
https://vueuse.org/shared/tryOnScopeDispose/#VPContent | tryOnScopeDispose
Category
Component
Export Size
100 B
Last Changed
10 months ago
Safe onScopeDispose. Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
Usage
js
import { tryOnScopeDispose } from '@vueuse/core'
tryOnScopeDispose(() => {
})
Source
Source • Docs
Contributors
... | tryOnScopeDispose | VueUse |
https://vueuse.org/shared/tryonbeforeunmount/#VPContent | tryOnBeforeUnmount
Category
Component
Export Size
93 B
Last Changed
2 years ago
Safe onBeforeUnmount. Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
Usage
js
import { tryOnBeforeUnmount } from '@vueuse/core'
tryOnBeforeUnmount(() => {
})
Source
Source • Docs
Contributors
A... | tryOnBeforeUnmount | VueUse |
https://vueuse.org/shared/provideLocal/#VPContent | provideLocal
Category
State
Export Size
Last Changed
2 months ago
Extended provide with ability to call injectLocal to obtain the value in the same component.
Usage
vue
<script setup>
import { injectLocal, provideLocal } from '@vueuse/core'
provideLocal('MyInjectionKey', 1)
const injectedValue = injectLocal('MyI... | provideLocal | VueUse |
https://vueuse.org/shared/injectLocal/#VPContent | injectLocal
Category
State
Export Size
Last Changed
2 months ago
Extended inject with ability to call provideLocal to provide the value in the same component.
Usage
vue
<script setup>
import { injectLocal, provideLocal } from '@vueuse/core'
provideLocal('MyInjectionKey', 1)
const injectedValue = injectLocal('MyI... | injectLocal | VueUse |
https://vueuse.org/shared/useToString/ | useToString
Category
Utilities
Export Size
111 B
Last Changed
8 months ago
Reactively convert a ref to string.
Usage
ts
import { useToString } from '@vueuse/core'
const number = ref(3.14)
const str = useToString(number)
str.value // '3.14'
Source
Source • Docs
Contributors
Anthony Fu
Changelog
v10.0.0-b... | useToString | VueUse |
https://vueuse.org/shared/createInjectionState/#VPContent | createInjectionState
Category
State
Export Size
132 B
Last Changed
2 months ago
Create global state that can be injected into components.
Demo
source
+
count: 0
double: 0
Usage
TypeScript
ts
// useCounterStore.ts
import { computed, ref } from 'vue'
import { createInjectionState } from '@vueuse/shared'
const [... | createInjectionState | VueUse |
https://vueuse.org/shared/useToNumber/ | useToNumber
Category
Utilities
Export Size
203 B
Last Changed
6 months ago
Reactively convert a string ref to number.
Usage
ts
import { useToNumber } from '@vueuse/core'
const str = ref('123')
const number = useToNumber(str)
number.value // 123
Source
Source • Docs
Contributors
Anthony Fu
Changelog
v10.... | useToNumber | VueUse |
https://vueuse.org/shared/useToggle/ | useToggle
Category
Utilities
Export Size
200 B
Last Changed
2 months ago
A boolean switcher with utility functions.
Demo
source
Value: OFF
ToggleSet ONSet OFF
Usage
js
import { useToggle } from '@vueuse/core'
const [value, toggle] = useToggle()
When you pass a ref, useToggle will return a simple toggle fun... | useToggle | VueUse |
https://vueuse.org/shared/usethrottlefn/ | useThrottleFn
Category
Utilities
Export Size
401 B
Last Changed
2 months ago
Related
refDebounced
refThrottled
useDebounceFn
Throttle execution of a function. Especially useful for rate limiting execution of handlers on events like resize and scroll.
Throttle is a spring that throws balls: after a ball flies out it... | useThrottleFn | VueUse |
https://vueuse.org/shared/useDebounceFn/ | useDebounceFn
Category
Utilities
Export Size
372 B
Last Changed
2 months ago
Related
useThrottleFn
Debounce execution of a function.
Debounce is an overloaded waiter: if you keep asking him your requests will be ignored until you stop and give him some time to think about your latest inquiry.
Demo
source
Smash... | useDebounceFn | VueUse |
https://vueuse.org/shared/useCounter/ | useCounter
Category
Utilities
Export Size
185 B
Last Changed
2 months ago
Basic counter with utility functions.
Demo
source
Count: 0
IncrementDecrementIncrement (+5)Decrement (-5)Set (100)Reset
Basic Usage
js
import { useCounter } from '@vueuse/core'
const { count, inc, dec, set, reset } = useCounter()
Usag... | useCounter | VueUse |
https://vueuse.org/shared/set/ | set
Category
Utilities
Export Size
142 B
Last Changed
2 years ago
Shorthand for ref.value = x
Usage
ts
import { set } from '@vueuse/core'
const a = ref(0)
set(a, 1)
console.log(a.value) // 1
Source
Source • Docs
Contributors
Anthony Fu
Changelog
No recent changes | set | VueUse |
https://vueuse.org/shared/makeDestructurable/ | makeDestructurable
Category
Utilities
Export Size
364 B
Last Changed
last year
Make isomorphic destructurable for object and array at the same time. See this blog for more details.
Usage
TypeScript Example:
TypeScript
ts
import { makeDestructurable } from '@vueuse/core'
const foo = { name: 'foo' }
const bar = 1... | makeDestructurable | VueUse |
https://vueuse.org/shared/isDefined/ | isDefined
Category
Utilities
Export Size
86 B
Last Changed
7 months ago
Non-nullish checking type guard for Ref.
Usage
ts
import { isDefined } from '@vueuse/core'
const example = ref(Math.random() ? 'example' : undefined) // Ref<string | undefined>
if (isDefined(example))
example // Ref<string>
Source
Sour... | isDefined | VueUse |
https://vueuse.org/shared/get/ | get
Category
Utilities
Export Size
80 B
Last Changed
8 months ago
Shorthand for accessing ref.value
Usage
ts
import { get } from '@vueuse/core'
const a = ref(42)
console.log(get(a)) // 42
Source
Source • Docs
Contributors
Anthony Fu
Changelog
No recent changes | get | VueUse |
https://vueuse.org/shared/createeventhook/ | createEventHook
Category
Utilities
Export Size
212 B
Last Changed
last week
Utility for creating event hooks
Usage
Creating a function that uses createEventHook
TypeScript
ts
import { createEventHook } from '@vueuse/core'
export function useMyFetch(url) {
const fetchResult = createEventHook<Response>()
cons... | createEventHook | VueUse |
https://vueuse.org/shared/usedateformat/ | useDateFormat
Category
Time
Export Size
807 B
Last Changed
last week
Get the formatted date according to the string of tokens passed in, inspired by dayjs.
List of all available formats (HH:mm:ss by default):
Format Output Description
Yo 2018th Ordinal formatted year
YY 18 Two-digit year
YYYY 2018 Four-digit year
... | useDateFormat | VueUse |
https://vueuse.org/shared/usearrayunique/ | useArrayUnique
Category
Array
Export Size
215 B
Last Changed
2 months ago
reactive unique array
Usage
Use with array of multiple refs
js
import { useArrayUnique } from '@vueuse/core'
const item1 = ref(0)
const item2 = ref(1)
const item3 = ref(1)
const item4 = ref(2)
const item5 = ref(3)
const list = [item1, it... | useArrayUnique | VueUse |
https://vueuse.org/shared/useArraySome/ | useArraySome
Category
Array
Export Size
137 B
Last Changed
2 months ago
Reactive Array.some
Usage
Use with array of multiple refs
js
import { useArraySome } from '@vueuse/core'
const item1 = ref(0)
const item2 = ref(2)
const item3 = ref(4)
const item4 = ref(6)
const item5 = ref(8)
const list = [item1, item2, i... | useArraySome | VueUse |
https://vueuse.org/shared/useArrayReduce/ | useArrayReduce
Category
Array
Export Size
171 B
Last Changed
2 months ago
Reactive Array.reduce.
Usage
js
import { useArrayReduce } from '@vueuse/core'
const sum = useArrayReduce([ref(1), ref(2), ref(3)], (sum, val) => sum + val)
// sum.value: 6
Use with reactive array
js
import { useArrayReduce } from '@vueus... | useArrayReduce | VueUse |
https://vueuse.org/shared/usearrayevery/ | useArrayEvery
Category
Array
Export Size
137 B
Last Changed
2 months ago
Reactive Array.every
Usage
Use with array of multiple refs
js
import { useArrayEvery } from '@vueuse/core'
const item1 = ref(0)
const item2 = ref(2)
const item3 = ref(4)
const item4 = ref(6)
const item5 = ref(8)
const list = [item1, item2... | useArrayEvery | VueUse |
https://vueuse.org/shared/usearraydifference/ | useArrayDifference
Category
Array
Export Size
231 B
Last Changed
2 months ago
Reactive get array difference of two array
Usage
Use with reactive array
js
import { useArrayDifference } from '@vueuse/core'
const list1 = ref([0, 1, 2, 3, 4, 5])
const list2 = ref([4, 5, 6])
const result = useArrayDifference(list1,... | useArrayDifference | VueUse |
https://vueuse.org/shared/tovalue/ | toValue
Category
Reactivity
Export Size
92 B
Last Changed
7 months ago
Alias
resolveUnref
Related
toRef
Get the value of value/ref/getter.
Usage
ts
import { toValue } from '@vueuse/core'
const foo = ref('hi')
const a = toValue(0) // 0
const b = toValue(foo) // 'hi'
const c = toValue(() => 'hi') // 'hi'
Source
... | toValue | VueUse |
https://vueuse.org/shared/torefs/ | toRefs
Category
Reactivity
Export Size
451 B
Last Changed
4 months ago
Extended toRefs that also accepts refs of an object.
Usage
ts
import { toRefs } from '@vueuse/core'
import { reactive, ref } from 'vue'
const objRef = ref({ a: 'a', b: 0 })
const arrRef = ref(['a', 0])
const { a, b } = toRefs(objRef)
const [... | toRefs | VueUse |
https://vueuse.org/shared/toreactive/ | toReactive
Category
Reactivity
Export Size
242 B
Last Changed
4 months ago
Converts ref to reactive. Also made possible to create a "swapable" reactive object.
This function uses Proxy
It is NOT supported by IE 11 or below.
Usage
ts
import { toReactive } from '@vueuse/core'
const refState = ref({ foo: 'bar' })... | toReactive | VueUse |
https://vueuse.org/shared/toref/ | toRef
Category
Reactivity
Export Size
159 B
Last Changed
7 months ago
Alias
resolveRef
Related
toValue
Normalize value/ref/getter to ref or computed.
Usage
ts
import { toRef } from '@vueuse/core'
const foo = ref('hi')
const a = toRef(0) // Ref<number>
const b = toRef(foo) // Ref<string>
const c = toRef(() => 'h... | toRef | VueUse |
https://vueuse.org/shared/syncrefs/ | syncRefs
Category
Reactivity
Export Size
158 B
Last Changed
2 years ago
Related
syncRef
Keep target refs in sync with a source ref
Demo
source
Usage
ts
import { syncRefs } from '@vueuse/core'
const source = ref('hello')
const target = ref('target')
const stop = syncRefs(source, target)
console.log(target.v... | syncRefs | VueUse |
https://vueuse.org/shared/syncRef/ | syncRef
Category
Reactivity
Export Size
237 B
Last Changed
3 weeks ago
Related
syncRefs
Two-way refs synchronization.
Demo
source
Usage
ts
import { syncRef } from '@vueuse/core'
const a = ref('a')
const b = ref('b')
const stop = syncRef(a, b)
console.log(a.value) // a
b.value = 'foo'
console.log(a.value)... | syncRef | VueUse |
https://vueuse.org/shared/refWithControl/ | refWithControl
Category
Reactivity
Export Size
474 B
Last Changed
2 months ago
Alias
controlledRef
Related
computedWithControl
Fine-grained controls over ref and its reactivity.
WARNING
This function only works for Vue 3
Usage
refWithControl uses extendRef to provide two extra functions get and set to have bet... | refWithControl | VueUse |
https://vueuse.org/shared/refThrottled/ | refThrottled
Category
Reactivity
Export Size
458 B
Last Changed
2 months ago
Alias
useThrottle
throttledRef
Related
useThrottleFn
Throttle changing of a ref value.
Demo
source
Delay is set to 1000ms for this demo.
Throttled:
Times Updated: 0
Trailing: true
Leading: false
Usage
js
import { refThrottled } ... | refThrottled | VueUse |
https://vueuse.org/shared/refDefault/ | refDefault
Category
Reactivity
Export Size
107 B
Last Changed
2 months ago
Apply default value to a ref.
Usage
ts
import { refDefault, useStorage } from '@vueuse/core'
const raw = useStorage('key')
const state = refDefault(raw, 'default')
raw.value = 'hello'
console.log(state.value) // hello
raw.value = undefi... | refDefault | VueUse |
https://vueuse.org/shared/refAutoReset/ | refAutoReset
Category
Reactivity
Export Size
234 B
Last Changed
3 months ago
Alias
autoResetRef
A ref which will be reset to the default value after some time.
Demo
source
Change Message
Default message
Usage
ts
import { refAutoReset } from '@vueuse/core'
const message = refAutoReset('default message', 100... | refAutoReset | VueUse |
https://vueuse.org/shared/reactivePick/ | reactivePick
Category
Reactivity
Export Size
454 B
Last Changed
8 months ago
Reactively pick fields from a reactive object.
Usage
Basic Usage
ts
import { reactivePick } from '@vueuse/core'
const obj = reactive({
x: 0,
y: 0,
elementX: 0,
elementY: 0,
})
const picked = reactivePick(obj, 'x', 'elementX')... | reactivePick | VueUse |
https://vueuse.org/shared/refdebounced/ | refDebounced
Category
Reactivity
Export Size
423 B
Last Changed
8 months ago
Alias
useDebounce
debouncedRef
Related
useThrottleFn
Debounce execution of a ref value.
Demo
source
Delay is set to 1000ms for this demo.
Debounced:
Times Updated: 0
Usage
js
import { refDebounced } from '@vueuse/core'
const inpu... | refDebounced | VueUse |
https://vueuse.org/shared/reactiveomit/ | reactiveOmit
Category
Reactivity
Export Size
381 B
Last Changed
2 months ago
Reactively omit fields from a reactive object.
Usage
Basic Usage
ts
import { reactiveOmit } from '@vueuse/core'
const obj = reactive({
x: 0,
y: 0,
elementX: 0,
elementY: 0,
})
const picked = reactiveOmit(obj, 'x', 'elementX')... | reactiveOmit | VueUse |
https://vueuse.org/shared/reactivecomputed/ | reactiveComputed
Category
Reactivity
Export Size
264 B
Last Changed
4 months ago
Computed reactive object. Instead of returning a ref that computed does, reactiveComputed returns a reactive object.
This function uses Proxy
It is NOT supported by IE 11 or below.
Usage
ts
import { reactiveComputed } from '@vueuse... | reactiveComputed | VueUse |
https://vueuse.org/shared/reactifyobject/ | reactifyObject
Category
Reactivity
Export Size
305 B
Last Changed
5 months ago
Apply reactify to an object
Usage
ts
import { reactifyObject } from '@vueuse/core'
const reactifiedConsole = reactifyObject(console)
const a = ref('42')
reactifiedConsole.log(a) // no longer need `.value`
Source
Source • Docs
Co... | reactifyObject | VueUse |
https://vueuse.org/shared/extendRef/ | extendRef
Category
Reactivity
Export Size
282 B
Last Changed
8 months ago
Add extra attributes to Ref.
WARNING
This function only works for Vue 2.7 or above.
Usage
Please note the extra attribute will not be accessible in Vue's template.
ts
import { ref } from 'vue'
import { extendRef } from '@vueuse/core'
c... | extendRef | VueUse |
https://vueuse.org/shared/reactify/ | reactify
Category
Reactivity
Export Size
174 B
Last Changed
7 months ago
Alias
createReactiveFn
Related
createUnrefFn
Converts plain functions into reactive functions. The converted function accepts refs as its arguments and returns a ComputedRef, with proper typing.
TIP
Interested to see some application or looki... | reactify | VueUse |
https://vueuse.org/shared/computedwithcontrol/ | computedWithControl
Category
Reactivity
Export Size
250 B
Last Changed
7 months ago
Alias
controlledComputed
Related
refWithControl
Explicitly define the dependencies of computed.
Usage
TypeScript
ts
import { computedWithControl } from '@vueuse/core'
const source = ref('foo')
const counter = ref(0)
const computed... | computedWithControl | VueUse |
https://vueuse.org/shared/computedEager/ | computedEager
Category
Reactivity
Export Size
398 B
Last Changed
2 years ago
Alias
eagerComputed
Eager computed without lazy evaluation.
Learn more at Vue: When a computed property can be the wrong tool.
Use computed() when you have a complex calculation going on, which can actually profit from caching and lazy ev... | computedEager | VueUse |
https://vueuse.org/shared/whenever/ | whenever
Category
Watch
Export Size
97 B
Last Changed
last year
Shorthand for watching value to be truthy.
Usage
js
import { useAsyncState, whenever } from '@vueuse/core'
const { state, isReady } = useAsyncState(
fetch('https://jsonplaceholder.typicode.com/todos/1').then(t => t.json()),
{},
)
whenever(isRea... | whenever | VueUse |
https://vueuse.org/shared/watchwithfilter/ | watchWithFilter
Category
Watch
Export Size
373 B
Last Changed
last year
watch with additional EventFilter control.
Usage
Similar to watch, but offering an extra option eventFilter which will be applied to the callback function.
ts
import { debounceFilter, watchWithFilter } from '@vueuse/core'
watchWithFilter(
... | watchWithFilter | VueUse |
https://vueuse.org/shared/watchTriggerable/ | watchTriggerable
Category
Watch
Export Size
942 B
Last Changed
8 months ago
Watch that can be triggered manually
Demo
source
Value: 0
UpdateManual TriggerReset
Log (500 ms delay)
Usage
A watch wrapper that supports manual triggering of WatchCallback, which returns an additional trigger to execute a WatchCal... | watchTriggerable | VueUse |
https://vueuse.org/shared/watchThrottled/ | watchThrottled
Category
Watch
Export Size
831 B
Last Changed
8 months ago
Alias
throttledWatch
Throttled watch.
Demo
source
Delay is set to 1000ms for this demo.
Input:
Times Updated: 0
Usage
Similar to watch, but offering an extra option throttle which will be applied to the callback function.
ts
import... | watchThrottled | VueUse |
https://vueuse.org/shared/watchPausable/ | watchPausable
Category
Watch
Export Size
674 B
Last Changed
last year
Alias
pausableWatch
Pausable watch
Demo
source
Type something below to trigger the watch
PauseResumeClear Log
Log
Usage
Use as normal the watch, but return extra pause() and resume() functions to control.
ts
import { watchPausable } fro... | watchPausable | VueUse |
https://vueuse.org/shared/watchOnce/ | watchOnce
Category
Watch
Export Size
107 B
Last Changed
3 weeks ago
watch that only triggers once.
Usage
After the callback function has been triggered once, the watch will be stopped automatically.
ts
import { watchOnce } from '@vueuse/core'
watchOnce(source, () => {
// triggers only once
console.log('sou... | watchOnce | VueUse |
https://vueuse.org/shared/watchImmediate/ | watchImmediate
Category
Watch
Export Size
322 B
Last Changed
6 months ago
Shorthand for watching value with {immediate: true}
Usage
Similar to watch, but with { immediate: true }
ts
import { watchImmediate } from '@vueuse/core'
const obj = ref('vue-use')
// changing the value from some external store/composab... | watchImmediate | VueUse |
https://vueuse.org/shared/watchignorable/ | watchIgnorable
Category
Watch
Export Size
708 B
Last Changed
last year
Alias
ignorableWatch
Ignorable watch
Demo
source
Value: 0
UpdateIgnored UpdateReset
Log
Usage
Extended watch that returns extra ignoreUpdates(updater) and ignorePrevAsyncUpdates() to ignore particular updates to the source.
ts
import { ... | watchIgnorable | VueUse |
https://vueuse.org/shared/watchdeep/ | watchDeep
Category
Watch
Export Size
325 B
Last Changed
7 months ago
Shorthand for watching value with {deep: true}
Usage
Similar to watch, but with { deep: true }
ts
import { watchDeep } from '@vueuse/core'
const nestedObject = ref({ foo: { bar: { deep: 5 } } })
watchDeep(nestedObject, (obj) => {
console.l... | watchDeep | VueUse |
https://vueuse.org/shared/watchAtMost/ | watchAtMost
Category
Watch
Export Size
510 B
Last Changed
8 months ago
watch with the number of times triggered.
Usage
Similar to watch with an extra option count which set up the number of times the callback function is triggered. After the count is reached, the watch will be stopped automatically.
ts
import {... | watchAtMost | VueUse |
https://vueuse.org/shared/watchArray/ | watchArray
Category
Watch
Export Size
281 B
Last Changed
2 months ago
Watch for an array with additions and removals.
Usage
Similar to watch, but provides the added and removed elements to the callback function. Pass { deep: true } if the list is updated in place with push, splice, etc.
ts
import { watchArray }... | watchArray | VueUse |
https://vueuse.org/shared/watchDebounced/ | watchDebounced
Category
Watch
Export Size
786 B
Last Changed
8 months ago
Alias
debouncedWatch
Debounced watch
Demo
source
Delay is set to 1000ms and maxWait is set to 5000ms for this demo.
Input:
Times Updated: 0
Usage
Similar to watch, but offering extra options debounce and maxWait which will be applie... | watchDebounced | VueUse |
https://vueuse.org/shared/until/ | until
Category
Watch
Export Size
595 B
Last Changed
4 months ago
Promised one-time watch for changes
Demo
source
Add to 7 to show the alert.
Count: 0
IncrementDecrement
Usage
Wait for some async data to be ready
js
import { until, useAsyncState } from '@vueuse/core'
const { state, isReady } = useAsyncSta... | until | VueUse |
https://vueuse.org/shared/tryOnUnmounted/ | tryOnUnmounted
Category
Component
Export Size
85 B
Last Changed
2 years ago
Safe onUnmounted. Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
Usage
js
import { tryOnUnmounted } from '@vueuse/core'
tryOnUnmounted(() => {
})
Source
Source • Docs
Contributors
Anthony Fu
Changelog
... | tryOnUnmounted | VueUse |
https://vueuse.org/shared/tryonscopedispose/ | tryOnScopeDispose
Category
Component
Export Size
100 B
Last Changed
10 months ago
Safe onScopeDispose. Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
Usage
js
import { tryOnScopeDispose } from '@vueuse/core'
tryOnScopeDispose(() => {
})
Source
Source • Docs
Contributors
... | tryOnScopeDispose | VueUse |
https://vueuse.org/shared/tryOnMounted/ | tryOnMounted
Category
Component
Export Size
109 B
Last Changed
2 years ago
Safe onMounted. Call onMounted() if it's inside a component lifecycle, if not, just call the function
Usage
js
import { tryOnMounted } from '@vueuse/core'
tryOnMounted(() => {
})
Source
Source • Docs
Contributors
Anthony Fu
Connor ... | tryOnMounted | VueUse |
https://vueuse.org/shared/tryonbeforeunmount/ | tryOnBeforeUnmount
Category
Component
Export Size
93 B
Last Changed
2 years ago
Safe onBeforeUnmount. Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
Usage
js
import { tryOnBeforeUnmount } from '@vueuse/core'
tryOnBeforeUnmount(() => {
})
Source
Source • Docs
Contributors
A... | tryOnBeforeUnmount | VueUse |
https://vueuse.org/shared/tryOnBeforeMount/ | tryOnBeforeMount
Category
Component
Export Size
114 B
Last Changed
last year
Safe onBeforeMount. Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
Usage
js
import { tryOnBeforeMount } from '@vueuse/core'
tryOnBeforeMount(() => {
})
Source
Source • Docs
Contributors
... | tryOnBeforeMount | VueUse |
https://vueuse.org/shared/useTimeoutFn/ | useTimeoutFn
Category
Animation
Export Size
303 B
Last Changed
8 months ago
Wrapper for setTimeout with controls.
Demo
source
Please wait for 3 seconds
Restart
Usage
js
import { useTimeoutFn } from '@vueuse/core'
const { isPending, start, stop } = useTimeoutFn(() => {
/* ... */
}, 3000)
Source
Source •... | useTimeoutFn | VueUse |
https://vueuse.org/shared/useIntervalFn/ | useIntervalFn
Category
Animation
Export Size
341 B
Last Changed
8 months ago
Wrapper for setInterval with controls
Demo
source
Hello
interval:
Pause
Usage
js
import { useIntervalFn } from '@vueuse/core'
const { pause, resume, isActive } = useIntervalFn(() => {
/* your function */
}, 1000)
Source
Sourc... | useIntervalFn | VueUse |
https://vueuse.org/shared/useTimeout/ | useTimeout
Category
Animation
Export Size
565 B
Last Changed
last year
Update value after a given time with controls.
Demo
source
Ready: false
Start Again
Usage
js
import { promiseTimeout, useTimeout } from '@vueuse/core'
const ready = useTimeout(1000)
js
const { ready, start, stop } = useTimeout(1000, { co... | useTimeout | VueUse |
https://vueuse.org/shared/useInterval/ | useInterval
Category
Animation
Export Size
620 B
Last Changed
8 months ago
Reactive counter increases on every interval
Demo
source
Interval fired: 0
Usage
js
import { useInterval } from '@vueuse/core'
// count will increase every 200ms
const counter = useInterval(200)
ts
const { counter, reset, pause, resu... | useInterval | VueUse |
https://vueuse.org/shared/useLastChanged/ | useLastChanged
Category
State
Export Size
143 B
Last Changed
2 months ago
Records the timestamp of the last change
Demo
source
Last changed: 5 minutes ago (1701205660123)
Usage
ts
import { useLastChanged } from '@vueuse/core'
import { nextTick } from 'vue-demi'
const a = ref(0)
const lastChanged = useLastCha... | useLastChanged | VueUse |
https://vueuse.org/shared/providelocal/ | provideLocal
Category
State
Export Size
Last Changed
2 months ago
Extended provide with ability to call injectLocal to obtain the value in the same component.
Usage
vue
<script setup>
import { injectLocal, provideLocal } from '@vueuse/core'
provideLocal('MyInjectionKey', 1)
const injectedValue = injectLocal('MyI... | provideLocal | VueUse |
https://vueuse.org/shared/injectlocal/ | injectLocal
Category
State
Export Size
Last Changed
last month
Extended inject with ability to call provideLocal to provide the value in the same component.
Usage
vue
<script setup>
import { injectLocal, provideLocal } from '@vueuse/core'
provideLocal('MyInjectionKey', 1)
const injectedValue = injectLocal('MyInj... | injectLocal | VueUse |
https://vueuse.org/shared/createSharedComposable/ | createSharedComposable
Category
State
Export Size
213 B
Last Changed
9 months ago
Related
createGlobalState
Make a composable function usable with multiple Vue instances.
Usage
ts
import { createSharedComposable, useMouse } from '@vueuse/core'
const useSharedMouse = createSharedComposable(useMouse)
// CompA.vue... | createSharedComposable | VueUse |
https://vueuse.org/shared/createinjectionstate/ | createInjectionState
Category
State
Export Size
132 B
Last Changed
last month
Create global state that can be injected into components.
Demo
source
+
count: 0
double: 0
Usage
TypeScript
ts
// useCounterStore.ts
import { computed, ref } from 'vue'
import { createInjectionState } from '@vueuse/shared'
const [us... | createInjectionState | VueUse |
https://vueuse.org/shared/createGlobalState/ | createGlobalState
Category
State
Export Size
125 B
Last Changed
7 months ago
Related
createSharedComposable
Keep states in the global scope to be reusable across Vue instances.
Demo
source
name: 'Banana'
color: 'Yellow'
size: 'Medium'
Usage
Without Persistence (Store in Memory)
js
// store.js
import { ref ... | createGlobalState | VueUse |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.