用ant-vue封装table组件时怎么在父组件中传递操作插槽?
试了这几个都不管用,现在父组件的插槽写法是什么样的呢?
<OperationTable :pagination="true"
:tableColumns="columns3"
:tableDatas="columns3TableData"
:scrolls="{ y: 500 }"
:size="'middle'"
>
<!-- <template slots="customRender: 'delete1'" slots-scope="{ record, text }"> -->
<!-- <template v-slot:delete1="record">
<a-button type="primary" @click="impedanceDeletes(record)">删除</a-button>
</template> -->
<template #delete1="record">
<a-button type="primary" @click="impedanceDeletes(record)">删除</a-button>
</template>
</OperationTable>
#delete1
这个操作直接放在子组件可以出现,但放在父组件无法显示。
<a-table:scroll="scrolls"
v-if="scrolls"
:columns="tableColumns"
:data-source="tableDatas"
:size="size"
:pagination="pagination">
<template v-for="col in ['dateTime', 'newEnergyOutput', 'newEnergyForecast']" #[col]="{ text, record }" :key="col">
<div>
<a-input v-if="editableData[record.key]" v-model:value="editableData[record.key][col]" style="margin: -5px 0" />
<template v-else>
{{ text }}
</template>
</div>
</template>
<!-- 操作 -->
<template #delete1="{ record }">
<div class="editable-row-operations editable-row-operations-delete">
<a-button type="primary" @click="impedanceDeletes(record)">删除</a-button>
</div>
</template>
</a-table>
回答:
这篇文章应该可以帮助你解决这个问题
https://www.jianshu.com/p/02a5b044926d
以上是 用ant-vue封装table组件时怎么在父组件中传递操作插槽? 的全部内容, 来源链接: utcz.com/p/934224.html