SilverShade
SilverShade
Explore posts from servers
NNuxt
Created by SilverShade on 4/20/2024 in #❓・help
Form data reset in <input /> tags
the solution i came up with is the following: i bound each <input /> to a respective model, and i reset the model before the component gets unmounted: The question is: Is this a good practice and is there a better way to achieve the same result?
<input :v-model="cardNumber" class="input-value" placeholder="0000 0000 0000 0000" />
<input :v-model="cardNumber" class="input-value" placeholder="0000 0000 0000 0000" />
const cardNumber = ref("")

onBeforeUnmount(() => {
cardNumber.value = ""
})
const cardNumber = ref("")

onBeforeUnmount(() => {
cardNumber.value = ""
})
3 replies