环境:
vue@^2.6.10:
vuetify@^2.1.0
我想用v-data-table
来显示搜索结果,并在v-data-table
中的每一行添加evaluate按钮.
不幸的是,我有两个问题:
- 判断按钮不显示
- 我不知道如何获取按下按钮的行数据
我需要改变什么?
样板
<v-data-table
:headers="headers"
:items="search_result"
>
<template slot="items" slot-scope="row">
<td>{{row.item.no}}</td>
<td>{{row.item.result}}</td>
<td>
<v-btn class="mx-2" fab dark small color="pink">
<v-icon dark>mdi-heart</v-icon>
</v-btn>
</td>
</template>
</v-data-table>
playbook
data () {
return {
headers: [
{ text: 'no', value: 'no' },
{ text: 'result', value: 'result' },
{ text: 'good', value: 'good'},
],
// in real case initial search_result = [], and methods: search function inject below data
search_result: [{no: 0, result: 'aaa'}, {no:2, result: 'bbb'],
}
},