mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-06 13:43:32 +08:00
fix: 修复 FaDrawer 和 FaModal 组件开启时警告错误
This commit is contained in:
Executable → Regular
Executable → Regular
+5
@@ -50,6 +50,7 @@ const slots = defineSlots<{
|
||||
footer?: () => VNode
|
||||
}>()
|
||||
|
||||
const sheetContentRef = useTemplateRef('sheetContentRef')
|
||||
const drawerId = shallowRef(props.id ?? useId())
|
||||
const isOpen = ref(props.modelValue)
|
||||
|
||||
@@ -140,6 +141,9 @@ function handleOpenAutoFocus(e: Event) {
|
||||
if (!props.openAutoFocus) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
nextTick(() => {
|
||||
sheetContentRef.value?.el?.$el?.focus()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +180,7 @@ function handleAnimationEnd() {
|
||||
<template>
|
||||
<Sheet :open="isOpen" @update:open="updateOpen">
|
||||
<SheetContent
|
||||
ref="sheetContentRef"
|
||||
:drawer-id="drawerId"
|
||||
:open="isOpen"
|
||||
:z-index="props.zIndex"
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
+7
@@ -38,6 +38,12 @@ const delegatedProps = reactiveOmit(props, 'class', 'side')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
|
||||
const sheetContentRef = useTemplateRef<ComponentPublicInstance<typeof DialogContent>>('sheetContentRef')
|
||||
|
||||
defineExpose({
|
||||
el: sheetContentRef,
|
||||
})
|
||||
|
||||
const showOverlay = computed(() => props.open && props.overlay)
|
||||
</script>
|
||||
|
||||
@@ -67,6 +73,7 @@ const showOverlay = computed(() => props.open && props.overlay)
|
||||
</Transition>
|
||||
<SheetOverlay class="hidden" />
|
||||
<DialogContent
|
||||
ref="sheetContentRef"
|
||||
data-slot="sheet-content"
|
||||
:class="cn(
|
||||
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+3
@@ -174,6 +174,9 @@ function handleOpenAutoFocus(e: Event) {
|
||||
if (!props.openAutoFocus) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
nextTick(() => {
|
||||
dialogContentRef.value?.el?.$el?.focus()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
Reference in New Issue
Block a user