Skip to content
Advertisement

Click-and-edit text input with Vue

I’m looking for a click-and-edit Vue component.

I’ve found a fiddle and made some edits. It works like this:

enter image description here

The fiddle is here.

The problem: I need an additional click to make the input focused. How can I make it focused automatically?

The code from the fiddle. HTML:

JavaScript

JS:

JavaScript

Advertisement

Answer

You can use a directive, for example

JS

JavaScript

HTML

JavaScript

You can find more info here https://v2.vuejs.org/v2/guide/custom-directive.html

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement