Skip to content

Update v-model value via template ref #3899

Answered by logaretm
veronQ asked this question in Q&A
Discussion options

You must be logged in to vote

You have a few options here, you could either use Ref on the Field component instead of the input and call handleChange off that ref.

<Field v-slot="{ field, value }" name="address.full" ref="field">
  <label for="address" >
    Address
  </label>
  <input v-bind="field"
               id="address.full"
               ref="searchRef"
               name="address.full"
               type="text"
               @focus.once="loadGoogleMaps"
  />
</Field>
export default async function useAddress(input: Ref, field: InstanceType<typeof Field>): Promise<void> {
  // ...
  ;(window as any).google.maps.event.addListener(instance, 'place_changed', () => {
    // will update both
    field.value.han…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@veronQ
Comment options

Answer selected by veronQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants