mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
refactor(popover): use manual trigger when x and y is set
This commit is contained in:
parent
12a8381236
commit
6b2b15d4d7
@ -14,7 +14,7 @@ import {
|
||||
} from 'vue'
|
||||
import { VBinder, VTarget, FollowerPlacement } from 'vueuc'
|
||||
import { useMergedState, useCompitable, useIsMounted, useMemo } from 'vooks'
|
||||
import { call, keep, warn, getFirstSlotVNode, throwError } from '../../_utils'
|
||||
import { call, keep, warn, getFirstSlotVNode } from '../../_utils'
|
||||
import type {
|
||||
ExtractPublicPropTypes,
|
||||
ExtractInternalPropTypes,
|
||||
@ -231,16 +231,6 @@ export default defineComponent({
|
||||
const showTimerIdRef = ref<number | null>(null)
|
||||
const hideTimerIdRef = ref<number | null>(null)
|
||||
const positionManuallyRef = useMemo(() => {
|
||||
if (
|
||||
props.x !== undefined &&
|
||||
props.y !== undefined &&
|
||||
props.trigger !== 'manual'
|
||||
) {
|
||||
throwError(
|
||||
'popover',
|
||||
"Set the 'trigger' prop to 'manual', when you want to manually positioned."
|
||||
)
|
||||
}
|
||||
return props.x !== undefined && props.y !== undefined
|
||||
})
|
||||
// methods
|
||||
@ -410,7 +400,7 @@ export default defineComponent({
|
||||
triggerVNode.type === textVNodeType
|
||||
? h('span', [triggerVNode])
|
||||
: triggerVNode
|
||||
appendEvents(triggerVNode, this.trigger, {
|
||||
appendEvents(triggerVNode, positionManually ? 'manual' : this.trigger, {
|
||||
onClick: this.handleClick,
|
||||
onMouseenter: this.handleMouseEnter,
|
||||
onMouseleave: this.handleMouseLeave,
|
||||
|
Loading…
Reference in New Issue
Block a user