fix: 🐛 修复popover tooltip组件visibleArrow=false时弹出框距离元素间距过远的问题 (#792)

 Closes: #788
This commit is contained in:
QingHuan 2024-12-20 22:11:55 +08:00 committed by GitHub
parent bdb56537db
commit 3b6d10dbb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { getCurrentInstance, ref } from 'vue'
import { getRect, isObj } from '../common/util'
export function usePopover() {
export function usePopover(visibleArrow = true) {
const { proxy } = getCurrentInstance() as any
const popStyle = ref<string>('')
const arrowStyle = ref<string>('')
@ -80,7 +80,7 @@ export function usePopover() {
offset: number | number[] | Record<'x' | 'y', number>
) {
// arrow size
const arrowSize = 9
const arrowSize = visibleArrow ? 9 : 0
// 上下位(纵轴)对应的距离左边的距离
const verticalX = width.value / 2
// 上下位(纵轴)对应的距离底部的距离

View File

@ -76,7 +76,7 @@ const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'c
const queue = inject<Queue | null>(queueKey, null)
const selector: string = 'popover'
const { proxy } = getCurrentInstance() as any
const popover = usePopover()
const popover = usePopover(props.visibleArrow)
const showPopover = ref<boolean>(false) // popover

View File

@ -45,7 +45,7 @@ import { tooltipProps, type TooltipExpose } from './types'
const props = defineProps(tooltipProps)
const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'close'])
const popover = usePopover()
const popover = usePopover(props.visibleArrow)
const queue = inject<Queue | null>(queueKey, null)
const selector: string = 'tooltip'
const { proxy } = getCurrentInstance() as any