Skip to content

Commit

Permalink
fix: slots working in components
Browse files Browse the repository at this point in the history
修复vue新版本改动导致组件传递slots可能出现错误的问题
  • Loading branch information
mynetfan committed Aug 13, 2021
1 parent 93f9a19 commit b1f3176
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/CountDown/src/CountdownInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<CountButton :size="size" :count="count" :value="state" :beforeStartFunc="sendCodeApi" />
</template>
<template #[item]="data" v-for="item in Object.keys($slots).filter((k) => k !== 'addonAfter')">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
</a-input>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Drawer/src/BasicDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</ScrollContainer>
<DrawerFooter v-bind="getProps" @close="onClose" @ok="handleOk" :height="getFooterHeight">
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
</DrawerFooter>
</Drawer>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/src/BasicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:setFormModel="setFormModel"
>
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
</FormItem>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/src/components/ApiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
v-model:value="state"
>
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
<template #suffixIcon v-if="loading">
<LoadingOutlined spin />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/src/components/ApiTreeSelect.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<a-tree-select v-bind="getAttrs" @change="handleChange">
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
<template #suffixIcon v-if="loading">
<LoadingOutlined spin />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/src/BasicModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<template #footer v-if="!$slots.footer">
<ModalFooter v-bind="getBindValue" @ok="handleOk" @cancel="handleCancel">
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
</ModalFooter>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Page/src/PageWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<slot name="headerContent" v-else></slot>
</template>
<template #[item]="data" v-for="item in getHeaderSlots">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
</PageHeader>

Expand Down
2 changes: 1 addition & 1 deletion src/components/StrengthMeter/src/StrengthMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:disabled="disabled"
>
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>
</InputPassword>
<div :class="`${prefixCls}-bar`">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/src/BasicTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@change="handleTableChange"
>
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
<slot :name="item" v-bind="data"></slot>
<slot :name="item" v-bind="data || {}"></slot>
</template>

<template #[`header-${column.dataIndex}`] v-for="column in columns" :key="column.dataIndex">
Expand Down

0 comments on commit b1f3176

Please sign in to comment.