Skip to content

Commit

Permalink
fix(Space): fixed template white space bugs (#3401)
Browse files Browse the repository at this point in the history
* fix(TimePicker): fixed only support hh:mm format

* fix(TimePicker): disabled position only is  start

* fix(Upload): fixed vue error on uploadPastedFiles is false

* docs: add readonly in api

* fix: fixed template white space bugs

* chore: update snap
  • Loading branch information
myronliu347 authored Nov 27, 2024
1 parent 7ac83c7 commit 687f966
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/select/hooks/useSelectOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default function useSelectOptions(
// 处理 slots 中 t-option 与 t-option-group
const currentSlots = instance.proxy.$slots.default || [];
currentSlots.forEach((child) => {
if (!child.componentOptions) {
return;
}

const componentName = getVNodeComponentName(child);
if (componentName && componentName === getVueComponentName(Option)) {
// 独立选项
Expand Down
6 changes: 5 additions & 1 deletion src/space/space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ export default defineComponent({

render() {
const { COMPONENT_NAME, spaceClassNames, renderStyle } = this;
const children = this.$slots.default?.filter((child) => child.tag !== undefined || child.text) || [];
const children = this.$slots.default || [];
const childCount = children?.length;
const renderChildren = () => children.map((child, index) => {
if (!child.tag && !child.text) {
return child;
}

const separatorNode = renderTNodeJSX(this, 'separator');
const showSeparator = index + 1 !== childCount && separatorNode;
return [
Expand Down
21 changes: 21 additions & 0 deletions test/snap/__snapshots__/csr.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -70964,6 +70964,7 @@ exports[`csr snapshot test > csr test ./src/loading/_example/delay.vue 1`] = `
</svg>
</div>
</div>
<!---->
</div>
</div>
<div
Expand Down Expand Up @@ -77528,6 +77529,7 @@ exports[`csr snapshot test > csr test ./src/notification/_example/base.vue 1`] =
</div>
</div>
</div>
<!---->
</div>
`;

Expand Down Expand Up @@ -113447,6 +113449,7 @@ exports[`csr snapshot test > csr test ./src/tooltip/_example/duration.vue 1`] =
</span>
</button>
</div>
<!---->
</div>
`;

Expand Down Expand Up @@ -123824,6 +123827,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -123910,6 +123914,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
</span>
</button>
</div>
<!---->
</div>
</span>
</div>
Expand Down Expand Up @@ -123969,6 +123974,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
</span>
</button>
</div>
<!---->
</div>
</span>
</div>
Expand Down Expand Up @@ -124028,6 +124034,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
</span>
</button>
</div>
<!---->
</div>
</span>
</div>
Expand Down Expand Up @@ -124085,6 +124092,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -124143,6 +124151,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -124201,6 +124210,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -124272,6 +124282,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -124358,6 +124369,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
</span>
</button>
</div>
<!---->
</div>
</span>
</div>
Expand Down Expand Up @@ -124417,6 +124429,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
</span>
</button>
</div>
<!---->
</div>
</span>
</div>
Expand Down Expand Up @@ -124476,6 +124489,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
</span>
</button>
</div>
<!---->
</div>
</span>
</div>
Expand Down Expand Up @@ -124533,6 +124547,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -124591,6 +124606,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -124649,6 +124665,7 @@ exports[`csr snapshot test > csr test ./src/tree/_example/disabled.vue 1`] = `
class="t-space t-space-horizontal"
style="gap: 10px;"
>
<!---->
<div
class="t-space-item"
>
Expand Down Expand Up @@ -135655,6 +135672,8 @@ exports[`csr snapshot test > csr test ./src/upload/_example/base.vue 1`] = `
</span>
</label>
</div>
<!---->
<!---->
<div
class="t-space-item"
>
Expand All @@ -135678,6 +135697,7 @@ exports[`csr snapshot test > csr test ./src/upload/_example/base.vue 1`] = `
</span>
</label>
</div>
<!---->
</div>
</div>
<div
Expand Down Expand Up @@ -136475,6 +136495,7 @@ exports[`csr snapshot test > csr test ./src/upload/_example/image.vue 1`] = `
</span>
</label>
</div>
<!---->
</div>
</div>
<div
Expand Down
Loading

0 comments on commit 687f966

Please sign in to comment.