Skip to content

Commit

Permalink
feat(ProTable): 🚀 插槽引入ElTable的scope,可获取$index等
Browse files Browse the repository at this point in the history
  • Loading branch information
wan-kong committed Mar 14, 2023
1 parent 5f5f457 commit 4cb7dba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/ProTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
</el-table-column>
<!-- expand 支持 tsx 语法 && 作用域插槽 (tsx > slot) -->
<el-table-column v-bind="item" :align="item.align ?? 'center'" v-if="item.type == 'expand'" v-slot="scope">
<component :is="item.render" :row="scope.row" v-if="item.render"> </component>
<slot :name="item.type" :row="scope.row" v-else></slot>
<component :is="item.render" v-bind="scope" v-if="item.render"> </component>
<slot :name="item.type" v-bind="scope" v-else></slot>
</el-table-column>
<!-- other 循环递归 -->
<TableColumn v-if="!item.type && item.prop && item.isShow" :column="item">
<template v-for="slot in Object.keys($slots)" #[slot]="scope">
<slot :name="slot" :row="scope.row"></slot>
<slot :name="slot" v-bind="scope"></slot>
</template>
</TableColumn>
</template>
Expand Down

0 comments on commit 4cb7dba

Please sign in to comment.