Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit67b6f9a

Browse files
committed
refactor(CFocusTrap): expose container reference properly
1 parent9dae4d7 commit67b6f9a

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

‎packages/coreui-vue/src/components/focus-trap/CFocusTrap.ts‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,25 @@ const CFocusTrap = defineComponent({
278278
containerRef,
279279
})
280280

281-
return()=>
282-
slots.default?.().map((slot)=>
283-
cloneVNode(slot,{
284-
ref:(el)=>{
285-
containerRef.value=elasHTMLElement|null
286-
},
287-
})
288-
)
281+
return()=>{
282+
constvnodes=slots.default?.()
283+
constvnode=vnodes?.[0]
284+
if(!vnode)returnnull
285+
286+
constoriginalRef=(vnode.propsasany)?.ref
287+
288+
returncloneVNode(vnode,{
289+
ref:(el)=>{
290+
containerRef.value=elasHTMLElement|null
291+
292+
if(typeoforiginalRef==='function'){
293+
originalRef(el)
294+
}elseif(originalRef&&typeoforiginalRef==='object'&&'value'inoriginalRef){
295+
;(originalRefas{value:any}).value=el
296+
}
297+
},
298+
})
299+
}
289300
},
290301
})
291302

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp