Search code examples
buttonvue.jsvue-componentquasar-frameworkquasar

Pass a variable on a function inside v-on:click or @click (Vue.js)


I'm developing a system with vuejs right now. I would like to know if how am I going to pass a variable value inside v-on:click or @click? this is my code:

The props.row contains an object with a key of '_id' and what I want to do is to pass that to the function 'view'.

<q-td key="status" :props="props">
  <q-btn
    color="primary"
    label="view"
    v-on:click="view({{props.row._id}})"
    icon="remove_red_eye"
  /> 
</q-td>

The program crashes.


Solution

  • Just in! Just resolve my own problem. lol this is what I did:

    <q-td key="status" :props="props">
      <q-btn
        color="primary"
        label="view"
        @click.native="view(props.row._id)"
        v-on
        icon="remove_red_eye"
      />
    </q-td>