Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:#1770,d-splitter 分割器,pane组件通过for循环实现,不显示bar #1771

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/devui-vue/devui/splitter/src/splitter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineComponent, reactive, ref, provide } from 'vue';
import { defineComponent, reactive, ref, provide, type VNode } from 'vue';
import DSplitterBar from './components/splitter-bar';
import { SplitterStore, type SplitterPane } from './splitter-store';
import { splitterProps, SplitterProps, SplitterState } from './splitter-types';
Expand All @@ -21,7 +21,15 @@ export default defineComponent({
const ns = useNamespace('splitter');

state.panes = ctx.slots.DSplitterPane?.() || [];

if (state.panes.length > 0) {
state.panes.forEach((item: VNode, index: number) => {
// 解决for循环 pane
if (item.children && item.children.length) {
state.panes.splice(index, 1);
state.panes = [...(item.children as VNode[]), ...state.panes];
}
});
}
store.setPanes({ panes: state.panes as unknown as SplitterPane[] });
provide('orientation', props.orientation);
provide('splitterStore', store);
Expand Down