20260821230656
This commit is contained in:
1 parent
2e5d532f23
commit
c43b4c8364
144 files changed
+7665
-242
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { computed, isVNode, nextTick, reactive, ref, useId, useSlots, watch } from 'vue'
|
||||
import { computed, Fragment, isVNode, nextTick, reactive, ref, useId, useSlots, watch } from 'vue'
|
||||
|
||||
/* ---------- props / emits / slots ---------- */
|
||||
const props = defineProps({
|
||||
@@ -80,8 +80,10 @@ const slotPanes = computed(() => {
|
||||
if (!isTabPane(node)) continue
|
||||
const paneProps = node.props ?? {}
|
||||
const { content, label } = extractChildren(node.children)
|
||||
// key 解析顺序:tabKey prop > vnode.key > 出现顺序索引
|
||||
const rawKey = paneProps.tabKey != null ? paneProps.tabKey : node.key != null ? node.key : index
|
||||
// 模板编译的 vnode.props 保留模板中原始属性名(kebab-case),h() 调用为 camelCase,两者都兼容
|
||||
const tabKey = paneProps.tabKey != null ? paneProps.tabKey : paneProps['tab-key']
|
||||
// 不能用 node.key 兜底:编译器会给带 v-if 的兄弟 TabPane 注入递增 key,导致多个 pane key 相同
|
||||
const rawKey = tabKey != null ? tabKey : index
|
||||
panes.push({
|
||||
key: String(rawKey),
|
||||
rawKey,
|
||||
|
||||
Reference in new issue
Block a user