The Vuetify3 text field component offers a clearable
prop to clear it easily. The help page shows the usage with the options API. But how do I get it working with the composition API?
CodePudding user response:
you don't need to do anything extra for it to work. You should pass a ref for the model to replace the one that is being defined on data()
<script setup>
import { ref } from 'vue'
const msg = ref('Hello')
</script>
<template>
<v-app>
<v-col>
<v-text-field
v-model="msg"
clearable
hide-details="auto"
label="Message"
></v-text-field>
</v-col>
</v-app>
</template>
I left you an example here: