Skip to content

Commit

Permalink
fix: 🐛 修复popover tooltip组件visibleArrow=false时弹出框距离元素间距过远的问题 (#792)
Browse files Browse the repository at this point in the history
Closes: #788
  • Loading branch information
RJQingHuan authored Dec 20, 2024
1 parent bdb5653 commit 3b6d10d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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>('')
Expand Down Expand Up @@ -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
// 上下位(纵轴)对应的距离底部的距离
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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显隐
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b6d10d

Please sign in to comment.