<q-table class="col-md-12" style="margin-top: 15px" dense :pagination="pigitions" :rows="rows" :columns="columns" row-key="ITEM_ID" :selected-rows-label="getSelectedString" selection="multiple" :loading="loading" v-model:selected="selected"> <template v-slot:unsignedaction="unsigned"> <td> <q-btn>{{ unsigned.row.DOC_UNSIGNED }}</q-btn> </td> </template> <template v-slot:signedaction="signed"> <td> <q-btn>{{ signed.row.DOC_SIGNED }}</q-btn> </td> </template> </q-table> 怎样让v-slot:unsignedaction有效
时间: 2024-02-14 22:13:59 浏览: 168
为了让 `v-slot:unsignedaction` 生效,需要在 `<q-table>` 组件中添加 `slot-scope` 属性,告诉 Vue.js 如何将插槽作用域传递给子组件。在这种情况下,`slot-scope` 属性应该设置为 `props`,以便在插槽中使用 `props.unsigned` 访问未签名行的数据。修改后的代码如下:
```
<q-table class="col-md-12" style="margin-top: 15px"
dense
:pagination="pigitions"
:rows="rows"
:columns="columns"
row-key="ITEM_ID"
:selected-rows-label="getSelectedString"
selection="multiple"
:loading="loading"
v-model:selected="selected"
slot-scope="props">
<template v-slot:unsignedaction="unsigned">
<td>
<q-btn>{{ props.unsigned.row.DOC_UNSIGNED }}</q-btn>
</td>
</template>
<template v-slot:signedaction="signed">
<td>
<q-btn>{{ signed.row.DOC_SIGNED }}</q-btn>
</td>
</template>
</q-table>
```
阅读全文