[Vuejs]-Vue js : How to set focus on disabled input field

3👍

Try this:

enableField (value) {
  const vm = this
  vm.detailsEditable = true
  vm.$nextTick(() => {
    vm.$refs.firstName.focus()
  })
}

I think issue is the timing of Vue’s rendering. Vue buffers changes and essentially renders asynchronously. For this reason, you will likely want to call focus in nextTick.

Leave a comment