[Vuejs]-How to setFocus on Next button press event in Ionic-vue app?

0👍

You could use ref template by defining it as property and use inside a event handler :

<template>
  <form @submit.prevent="onSubmit">
    <form-input
      enterkeyhint="next"
      @keyup.enter="changeFocus('password')"
    />

    <form-input
      ref="password"
    />
  </form>
</template>

<script lang="ts">
  // ... some import statements

  export default defineComponent({
    setup() { 
    const password=ref<string>("")
    function changeFocus(nextFocus: string): void {
        password.value.focus()
      }
    return{
      changeFocus, password,email
    }

    },

Leave a comment