[Vuejs]-How to emit an event in VueJS?

0👍

Since you want to listen to the click event of the TR element, you don’t need to emit an event or anything, you can do something like:

<template v-slot:items="props">
  <Row
    :active="props.active"
    :selected="props.selected"
    :name="props.item.name"
    :calories="props.item.calories"
    :fat="props.item.fat"
    @click.native="props.selected = !props.selected"
  />
</template>

that @click.native means that it will listen for the click event on the wrapper html element inside the template of the component

Leave a comment