Commit b1f31762e3c86a432a8d559ab957444eaf5525ad
1 parent
93f9a19a
fix: `slots` working in components
修复vue新版本改动导致组件传递slots可能出现错误的问题
Showing
9 changed files
with
9 additions
and
9 deletions
src/components/CountDown/src/CountdownInput.vue
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <CountButton :size="size" :count="count" :value="state" :beforeStartFunc="sendCodeApi" /> |
5 | 5 | </template> |
6 | 6 | <template #[item]="data" v-for="item in Object.keys($slots).filter((k) => k !== 'addonAfter')"> |
7 | - <slot :name="item" v-bind="data"></slot> | |
7 | + <slot :name="item" v-bind="data || {}"></slot> | |
8 | 8 | </template> |
9 | 9 | </a-input> |
10 | 10 | </template> | ... | ... |
src/components/Drawer/src/BasicDrawer.vue
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | </ScrollContainer> |
26 | 26 | <DrawerFooter v-bind="getProps" @close="onClose" @ok="handleOk" :height="getFooterHeight"> |
27 | 27 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
28 | - <slot :name="item" v-bind="data"></slot> | |
28 | + <slot :name="item" v-bind="data || {}"></slot> | |
29 | 29 | </template> |
30 | 30 | </DrawerFooter> |
31 | 31 | </Drawer> | ... | ... |
src/components/Form/src/BasicForm.vue
src/components/Form/src/components/ApiSelect.vue
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | v-model:value="state" |
8 | 8 | > |
9 | 9 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
10 | - <slot :name="item" v-bind="data"></slot> | |
10 | + <slot :name="item" v-bind="data || {}"></slot> | |
11 | 11 | </template> |
12 | 12 | <template #suffixIcon v-if="loading"> |
13 | 13 | <LoadingOutlined spin /> | ... | ... |
src/components/Form/src/components/ApiTreeSelect.vue
1 | 1 | <template> |
2 | 2 | <a-tree-select v-bind="getAttrs" @change="handleChange"> |
3 | 3 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
4 | - <slot :name="item" v-bind="data"></slot> | |
4 | + <slot :name="item" v-bind="data || {}"></slot> | |
5 | 5 | </template> |
6 | 6 | <template #suffixIcon v-if="loading"> |
7 | 7 | <LoadingOutlined spin /> | ... | ... |
src/components/Modal/src/BasicModal.vue
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <template #footer v-if="!$slots.footer"> |
21 | 21 | <ModalFooter v-bind="getBindValue" @ok="handleOk" @cancel="handleCancel"> |
22 | 22 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
23 | - <slot :name="item" v-bind="data"></slot> | |
23 | + <slot :name="item" v-bind="data || {}"></slot> | |
24 | 24 | </template> |
25 | 25 | </ModalFooter> |
26 | 26 | </template> | ... | ... |
src/components/Page/src/PageWrapper.vue
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <slot name="headerContent" v-else></slot> |
15 | 15 | </template> |
16 | 16 | <template #[item]="data" v-for="item in getHeaderSlots"> |
17 | - <slot :name="item" v-bind="data"></slot> | |
17 | + <slot :name="item" v-bind="data || {}"></slot> | |
18 | 18 | </template> |
19 | 19 | </PageHeader> |
20 | 20 | ... | ... |
src/components/StrengthMeter/src/StrengthMeter.vue
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | :disabled="disabled" |
10 | 10 | > |
11 | 11 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
12 | - <slot :name="item" v-bind="data"></slot> | |
12 | + <slot :name="item" v-bind="data || {}"></slot> | |
13 | 13 | </template> |
14 | 14 | </InputPassword> |
15 | 15 | <div :class="`${prefixCls}-bar`"> | ... | ... |
src/components/Table/src/BasicTable.vue
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | @change="handleTableChange" |
23 | 23 | > |
24 | 24 | <template #[item]="data" v-for="item in Object.keys($slots)" :key="item"> |
25 | - <slot :name="item" v-bind="data"></slot> | |
25 | + <slot :name="item" v-bind="data || {}"></slot> | |
26 | 26 | </template> |
27 | 27 | |
28 | 28 | <template #[`header-${column.dataIndex}`] v-for="column in columns" :key="column.dataIndex"> | ... | ... |