Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/refManualReset.md
1---2category: Reactivity3---45# refManualReset67Create a ref with manual reset functionality.89## Usage1011```ts12import { refManualReset } from '@vueuse/core'1314const message = refManualReset('default message')1516message.value = 'message has set'1718message.reset()1920console.log(message.value) // 'default message'21```2223## Type Declarations2425```ts26/**27* Define the shape of a ref that supports manual reset functionality.28*29* This interface extends the standard `Ref` type from Vue and adds a `reset` method.30* The `reset` method allows the ref to be manually reset to its default value.31*/32export interface ManualResetRefReturn<T> extends Ref<T> {33reset: Fn34}35/**36* Create a ref with manual reset functionality.37*38* @see https://vueuse.org/refManualReset39* @param defaultValue The value which will be set.40*/41export declare function refManualReset<T>(42defaultValue: MaybeRefOrGetter<T>,43): ManualResetRefReturn<T>44```45