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>
|
<script lang="ts" setup>
|
||||||
import { computed, inject, onMounted, provide, ref, unref, watch } from 'vue'
|
import { computed, inject, onMounted, provide, ref, unref, watch } from 'vue'
|
||||||
|
import { NOOP } from '@vue/shared'
|
||||||
import { createPopper } from '@popperjs/core'
|
import { createPopper } from '@popperjs/core'
|
||||||
import { useNamespace, useZIndex } from '@element-plus/hooks'
|
import { useNamespace, useZIndex } from '@element-plus/hooks'
|
||||||
import {
|
import {
|
||||||
@ -50,12 +51,18 @@ provide(POPPER_CONTENT_INJECTION_KEY, {
|
|||||||
arrowRef,
|
arrowRef,
|
||||||
arrowOffset,
|
arrowOffset,
|
||||||
})
|
})
|
||||||
// disallow auto-id from inside popper content
|
|
||||||
provide(formItemContextKey, {
|
if (
|
||||||
...formItemContext,
|
formItemContext &&
|
||||||
addInputId: () => undefined,
|
(formItemContext.addInputId || formItemContext.removeInputId)
|
||||||
removeInputId: () => undefined,
|
) {
|
||||||
})
|
// disallow auto-id from inside popper content
|
||||||
|
provide(formItemContextKey, {
|
||||||
|
...formItemContext,
|
||||||
|
addInputId: NOOP,
|
||||||
|
removeInputId: NOOP,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const contentZIndex = ref(props.zIndex || nextZIndex())
|
const contentZIndex = ref(props.zIndex || nextZIndex())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user