Este es mi componente.vue:
<template> <v-text-field name="Foo" :label="$t('foo')" type="text" hint="This is a hint" persistent-hint ></v-text-field> <v-btn color="primary" @click="onButtonClick()">Press</v-btn> </template>Y esto es componente.ts
import { defineComponent, reactive, ref, Ref} from 'vue'; export default defineComponent({ setup() { function onButtonClick() { } return { onButtonClick } } }); Quiero cambiar la sugerencia al hacer clic en el botón, por ejemplo, a This is a new hint . ¿Alguien podría decir cómo hacerlo en Vuetify 3 usando la API de composición?
Simplemente cree una propiedad de referencia llamada hint dentro del enlace de configuración, luego vincúlela al accesorio de hint y actualícela cuando haga clic en el botón:
import { defineComponent, reactive, ref, Ref} from 'vue'; export default defineComponent({ setup() { const hint=ref('This is a hint') function onButtonClick() { hint.value="new hint" } return { onButtonClick, hint } } });en plantilla:
<template> <v-text-field name="Foo" :label="$t('foo')" type="text" :hint="hint" persistent-hint ></v-text-field> <v-btn color="primary" @click="onButtonClick()">Press</v-btn> </template>