diff --git a/docs/en-US/component/select-v2.md b/docs/en-US/component/select-v2.md index 0a559a88c4..bfc5eedeff 100644 --- a/docs/en-US/component/select-v2.md +++ b/docs/en-US/component/select-v2.md @@ -187,6 +187,16 @@ select-v2/custom-tag ::: +## Custom Loading ^(2.5.2) + +Override loading content. + +:::demo + +select-v2/custom-loading + +::: + ## API ### Attributes @@ -256,14 +266,15 @@ select-v2/custom-tag ### Slots -| Name | Description | -|-----------------|---------------------------------------| -| default | Option renderer | -| header ^(2.5.2) | content at the top of the dropdown | -| footer ^(2.5.2) | content at the bottom of the dropdown | -| empty | content when options is empty | -| prefix | prefix content of input | -| tag ^(2.5.0) | content as Select tag | +| Name | Description | +|------------------|---------------------------------------| +| default | Option renderer | +| header ^(2.5.2) | content at the top of the dropdown | +| footer ^(2.5.2) | content at the bottom of the dropdown | +| empty | content when options is empty | +| prefix | prefix content of input | +| tag ^(2.5.0) | content as Select tag | +| loading ^(2.5.2) | content as Select loading | ### Exposes diff --git a/docs/en-US/component/select.md b/docs/en-US/component/select.md index 7e794bf66c..042db22348 100644 --- a/docs/en-US/component/select.md +++ b/docs/en-US/component/select.md @@ -149,6 +149,16 @@ select/custom-tag ::: +## Custom Loading ^(2.5.2) + +Override loading content. + +:::demo + +select/custom-loading + +::: + ## Select API ### Select Attributes @@ -214,14 +224,15 @@ select/custom-tag ### Select Slots -| Name | Description | Subtags | -|-----------------|---------------------------------------| --------------------- | -| default | option component list | Option Group / Option | -| header ^(2.4.3) | content at the top of the dropdown | — | -| footer ^(2.4.3) | content at the bottom of the dropdown | — | -| prefix | content as Select prefix | — | -| empty | content when there is no options | — | -| tag ^(2.5.0) | content as Select tag | — | +| Name | Description | Subtags | +|------------------|---------------------------------------|-----------------------| +| default | option component list | Option Group / Option | +| header ^(2.4.3) | content at the top of the dropdown | — | +| footer ^(2.4.3) | content at the bottom of the dropdown | — | +| prefix | content as Select prefix | — | +| empty | content when there is no options | — | +| tag ^(2.5.0) | content as Select tag | — | +| loading ^(2.5.2) | content as Select loading | — | ### Select Exposes diff --git a/docs/examples/select-v2/custom-loading.vue b/docs/examples/select-v2/custom-loading.vue new file mode 100644 index 0000000000..629775cb77 --- /dev/null +++ b/docs/examples/select-v2/custom-loading.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/docs/examples/select/custom-loading.vue b/docs/examples/select/custom-loading.vue new file mode 100644 index 0000000000..a1dc4cbb15 --- /dev/null +++ b/docs/examples/select/custom-loading.vue @@ -0,0 +1,230 @@ + + + + + diff --git a/packages/components/select-v2/src/select-dropdown.tsx b/packages/components/select-v2/src/select-dropdown.tsx index 713112aded..8bd5a5bab8 100644 --- a/packages/components/select-v2/src/select-dropdown.tsx +++ b/packages/components/select-v2/src/select-dropdown.tsx @@ -28,6 +28,7 @@ export default defineComponent({ name: 'ElSelectDropdown', props: { + loading: Boolean, data: { type: Array, required: true, @@ -225,7 +226,7 @@ export default defineComponent({ const { data, width } = props const { height, multiple, scrollbarAlwaysOn } = select.props - if (data.length === 0) { + if (slots.loading || slots.empty) { return (
- {slots.empty?.()} + {slots.loading?.() || slots.empty?.()}
) } diff --git a/packages/components/select-v2/src/select.vue b/packages/components/select-v2/src/select.vue index ec858a4dd0..1c8fc54316 100644 --- a/packages/components/select-v2/src/select.vue +++ b/packages/components/select-v2/src/select.vue @@ -225,12 +225,17 @@ -