[Vuejs]-How to switch between text input and h4 element

1👍

Try this below :

define a variable toggle and initially define it as true and then use v-if on your elements.

<input @dblclick="toggle=!toggle" v-if="toggle" /> 

<h4 v-if="!toggle" @dblclick="editComment(text)">{{text}}</h4>

editComment(item){
    item = 'New Comment';
    this.toggle = !this.toggle;
    };

Leave a comment