用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>
阅读 2.7k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题