[Vuejs]-Vue.js – onclick event doesnt fire

1👍

The solution with a v-for looks like this:

  <table>
<thead>
  <tr>
    <td>Internal_Key</td>
    <td>description</td>
    <td>description_sysops</td>
    <td>aktion</td>
  </tr>
</thead>
<tbody>
  <tr v-for="table in tabledata" :key="table.Internal_key">
    <td>{{ table.Internal_key }}</td>
    <td>{{ table[Object.getOwnPropertyNames(table)[1]][Object.getOwnPropertyNames(table[Object.getOwnPropertyNames(table)[1]])[0]] }}</td>
    <td>{{ table[Object.getOwnPropertyNames(table)[2]][Object.getOwnPropertyNames(table[Object.getOwnPropertyNames(table)[2]])[0]] }}</td>
    <td>
      <a class="button" @click="changeRecord">Aendern</a>
    </td>
  </tr>
</tbody>

and the code:

export default {
data() {
  return {
    tabledata: []
  };
},
methods: {
  changeRecord: function(event) {
    console.log("clickevent fired!");
  }
},
created() {
  this.$store.dispatch(USER_FETCHLIST).then(res => {

    this.tabledata = res.data;

  });
}
};

Leave a comment