20260820223837
This commit is contained in:
1 parent
68ac5db038
commit
45854b0570
48 files changed
+7545
-650
No files matched your search
@@ -36,11 +36,22 @@ const isVertical = computed(() => props.direction === 'vertical')
|
||||
|
||||
// 收集默认插槽中的 SplitterPanel 节点,过滤掉注释/空节点;
|
||||
// 统一为 { node, props } 结构:Vue 中未传 props 的 VNode 其 props 为 null,
|
||||
// 规范化后后续访问 panel.props.xxx 安全
|
||||
// 规范化后后续访问 panel.props.xxx 安全。
|
||||
// 注意:父模板上写的 kebab 属性(如 default-size / bar-on-hover)在 VNode.props
|
||||
// 中保留为 kebab 键,此处统一转成 camelCase,保证 displaySize()/applyOffset() 等
|
||||
// 读取 panel.props.defaultSize / panel.props.min / panel.props.max 时能命中。
|
||||
function camelize(str) {
|
||||
return str.replace(/-(\w)/g, (_, c) => c.toUpperCase())
|
||||
}
|
||||
const panelItems = computed(() =>
|
||||
(slots.default?.() ?? [])
|
||||
.filter((node) => node.type === SplitterPanel)
|
||||
.map((node) => ({ node, props: node.props ?? {} })),
|
||||
.map((node) => {
|
||||
const raw = node.props ?? {}
|
||||
const props = {}
|
||||
for (const key of Object.keys(raw)) props[camelize(key)] = raw[key]
|
||||
return { node, props }
|
||||
}),
|
||||
)
|
||||
|
||||
/* ---------- 尺寸工具 ---------- */
|
||||
|
||||
Reference in new issue
Block a user