mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 09:20:51 +08:00
fix(components): [popper] provide formItemContext conditionally (#7790)
This commit is contained in:
parent
488eaf5211
commit
6cc11662a6
@ -16,6 +16,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, inject, onMounted, provide, ref, unref, watch } from 'vue'
|
||||
import { NOOP } from '@vue/shared'
|
||||
import { createPopper } from '@popperjs/core'
|
||||
import { useNamespace, useZIndex } from '@element-plus/hooks'
|
||||
import {
|
||||
@ -50,12 +51,18 @@ provide(POPPER_CONTENT_INJECTION_KEY, {
|
||||
arrowRef,
|
||||
arrowOffset,
|
||||
})
|
||||
// disallow auto-id from inside popper content
|
||||
provide(formItemContextKey, {
|
||||
...formItemContext,
|
||||
addInputId: () => undefined,
|
||||
removeInputId: () => undefined,
|
||||
})
|
||||
|
||||
if (
|
||||
formItemContext &&
|
||||
(formItemContext.addInputId || formItemContext.removeInputId)
|
||||
) {
|
||||
// disallow auto-id from inside popper content
|
||||
provide(formItemContextKey, {
|
||||
...formItemContext,
|
||||
addInputId: NOOP,
|
||||
removeInputId: NOOP,
|
||||
})
|
||||
}
|
||||
|
||||
const contentZIndex = ref(props.zIndex || nextZIndex())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user