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,7 +4,7 @@ | ||
4 | <CountButton :size="size" :count="count" :value="state" :beforeStartFunc="sendCodeApi" /> | 4 | <CountButton :size="size" :count="count" :value="state" :beforeStartFunc="sendCodeApi" /> |
5 | </template> | 5 | </template> |
6 | <template #[item]="data" v-for="item in Object.keys($slots).filter((k) => k !== 'addonAfter')"> | 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 | </template> | 8 | </template> |
9 | </a-input> | 9 | </a-input> |
10 | </template> | 10 | </template> |
src/components/Drawer/src/BasicDrawer.vue
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | </ScrollContainer> | 25 | </ScrollContainer> |
26 | <DrawerFooter v-bind="getProps" @close="onClose" @ok="handleOk" :height="getFooterHeight"> | 26 | <DrawerFooter v-bind="getProps" @close="onClose" @ok="handleOk" :height="getFooterHeight"> |
27 | <template #[item]="data" v-for="item in Object.keys($slots)"> | 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 | </template> | 29 | </template> |
30 | </DrawerFooter> | 30 | </DrawerFooter> |
31 | </Drawer> | 31 | </Drawer> |
src/components/Form/src/BasicForm.vue
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | :setFormModel="setFormModel" | 19 | :setFormModel="setFormModel" |
20 | > | 20 | > |
21 | <template #[item]="data" v-for="item in Object.keys($slots)"> | 21 | <template #[item]="data" v-for="item in Object.keys($slots)"> |
22 | - <slot :name="item" v-bind="data"></slot> | 22 | + <slot :name="item" v-bind="data || {}"></slot> |
23 | </template> | 23 | </template> |
24 | </FormItem> | 24 | </FormItem> |
25 | </template> | 25 | </template> |
src/components/Form/src/components/ApiSelect.vue
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | v-model:value="state" | 7 | v-model:value="state" |
8 | > | 8 | > |
9 | <template #[item]="data" v-for="item in Object.keys($slots)"> | 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 | </template> | 11 | </template> |
12 | <template #suffixIcon v-if="loading"> | 12 | <template #suffixIcon v-if="loading"> |
13 | <LoadingOutlined spin /> | 13 | <LoadingOutlined spin /> |
src/components/Form/src/components/ApiTreeSelect.vue
1 | <template> | 1 | <template> |
2 | <a-tree-select v-bind="getAttrs" @change="handleChange"> | 2 | <a-tree-select v-bind="getAttrs" @change="handleChange"> |
3 | <template #[item]="data" v-for="item in Object.keys($slots)"> | 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 | </template> | 5 | </template> |
6 | <template #suffixIcon v-if="loading"> | 6 | <template #suffixIcon v-if="loading"> |
7 | <LoadingOutlined spin /> | 7 | <LoadingOutlined spin /> |
src/components/Modal/src/BasicModal.vue
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | <template #footer v-if="!$slots.footer"> | 20 | <template #footer v-if="!$slots.footer"> |
21 | <ModalFooter v-bind="getBindValue" @ok="handleOk" @cancel="handleCancel"> | 21 | <ModalFooter v-bind="getBindValue" @ok="handleOk" @cancel="handleCancel"> |
22 | <template #[item]="data" v-for="item in Object.keys($slots)"> | 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 | </template> | 24 | </template> |
25 | </ModalFooter> | 25 | </ModalFooter> |
26 | </template> | 26 | </template> |
src/components/Page/src/PageWrapper.vue
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <slot name="headerContent" v-else></slot> | 14 | <slot name="headerContent" v-else></slot> |
15 | </template> | 15 | </template> |
16 | <template #[item]="data" v-for="item in getHeaderSlots"> | 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 | </template> | 18 | </template> |
19 | </PageHeader> | 19 | </PageHeader> |
20 | 20 |
src/components/StrengthMeter/src/StrengthMeter.vue
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | :disabled="disabled" | 9 | :disabled="disabled" |
10 | > | 10 | > |
11 | <template #[item]="data" v-for="item in Object.keys($slots)"> | 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 | </template> | 13 | </template> |
14 | </InputPassword> | 14 | </InputPassword> |
15 | <div :class="`${prefixCls}-bar`"> | 15 | <div :class="`${prefixCls}-bar`"> |
src/components/Table/src/BasicTable.vue
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | @change="handleTableChange" | 22 | @change="handleTableChange" |
23 | > | 23 | > |
24 | <template #[item]="data" v-for="item in Object.keys($slots)" :key="item"> | 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 | </template> | 26 | </template> |
27 | 27 | ||
28 | <template #[`header-${column.dataIndex}`] v-for="column in columns" :key="column.dataIndex"> | 28 | <template #[`header-${column.dataIndex}`] v-for="column in columns" :key="column.dataIndex"> |