如何使用事件 @row-click 从 Quasar table 行获取数据

How to get data from a Quasar table row with the event @row-click

如何使用@row-click 事件从 table 中获取与行关联的数据?

在下面的例子中,如何获取点击行的id和name值?

<q-table
  title="Treats"
  dense
  :data="data"
  :columns="columns"
  row-key="id"
  @row-click="rowclick(evt, row)"
/>

(...)

  methods: {
    rowclick(evt, row){
      alert()
    }
  },

试试这个 @row-click="onRowClick"

     <q-table
          title="Treats"
          dense
          :data="data"
          :columns="columns"
          row-key="id"
          @row-click="onRowClick"
        />
      methods: {
        onRowClick (evt, row) {
          console.log('clicked on', row)
        }
      },

代码笔:https://codepen.io/Pratik__007/pen/qBdaeGY