Created
April 8, 2022 08:17
-
-
Save shershen08/9a0613bac25907256ef22ce2ea614d8e to your computer and use it in GitHub Desktop.
vueuse error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { ref } from 'vue' | |
import { watchDebounced } from '@vueuse/core' | |
export default { | |
setup(){ | |
const input = ref('') | |
const updated = ref(0) | |
watchDebounced(input, () => { | |
updated.value += 1 | |
}, { debounce: 1000 }) | |
return { | |
input, | |
updated | |
} | |
} | |
} | |
</script> | |
<template> | |
<div> | |
<input v-model="input" placeholder="Try to type anything..." type="text"> | |
<note>Delay is set to 1000ms for this demo.</note> | |
<p>Input: {{ input }}</p> | |
<p>Times Updated: {{ updated }}</p> | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment