Skip to content

Commit 197a03d

Browse files
authored
Update splitter.tsx
bugfix:DevCloudFE#1770,d-splitter 分割器,pane组件通过for循环实现,不显示bar
1 parent 4b5bdb5 commit 197a03d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/devui-vue/devui/splitter/src/splitter.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, reactive, ref, provide } from 'vue';
1+
import { defineComponent, reactive, ref, provide, type VNode } from 'vue';
22
import DSplitterBar from './components/splitter-bar';
33
import { SplitterStore, type SplitterPane } from './splitter-store';
44
import { splitterProps, SplitterProps, SplitterState } from './splitter-types';
@@ -21,7 +21,15 @@ export default defineComponent({
2121
const ns = useNamespace('splitter');
2222

2323
state.panes = ctx.slots.DSplitterPane?.() || [];
24-
24+
if (state.panes.length > 0) {
25+
state.panes.forEach((item: VNode, index: number) => {
26+
// 解决for循环 pane
27+
if (item.children && item.children.length) {
28+
state.panes.splice(index, 1);
29+
state.panes = [...(item.children as VNode[]), ...state.panes];
30+
}
31+
});
32+
}
2533
store.setPanes({ panes: state.panes as unknown as SplitterPane[] });
2634
provide('orientation', props.orientation);
2735
provide('splitterStore', store);

0 commit comments

Comments
 (0)