1

I have a modal. In that modal I am displaying a table. One of tr of that table is like below

<tr>
    <td class="ui header">Name</td>
    <td v-if="editValue">
        <input type="text">
        <input type="submit" value="Submit">                                 
    </td>
    <td v-else>
        {{ addressObj.name }}  
        <span @click="change_value" class="edit_span">
              Edit
        </span>   
    </td>
</tr>

The change_value is like below

change_value() {
    this.editValue = true;
}

If I click on Edit the input box is displayed but the modal is disappearing.

1 Answer 1

1

@click.stop.prevent="change_value"

It's likely that the click has somehow triggered the modal closing. Adding event.stopPropogation() and event.preventDefault() should help you avoid that.

.prevent add 'event.preventDefault()' to the click event

.stop add 'event.stopPropogation()' to the click event

See https://v2.vuejs.org/v2/guide/events.html#Event-Modifiers

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.