mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-08 01:58:52 +08:00
fix: 🐛 修复popover tooltip组件visibleArrow=false时弹出框距离元素间距过远的问题 (#792)
✅ Closes: #788
This commit is contained in:
parent
bdb56537db
commit
3b6d10dbb9
@ -1,7 +1,7 @@
|
|||||||
import { getCurrentInstance, ref } from 'vue'
|
import { getCurrentInstance, ref } from 'vue'
|
||||||
import { getRect, isObj } from '../common/util'
|
import { getRect, isObj } from '../common/util'
|
||||||
|
|
||||||
export function usePopover() {
|
export function usePopover(visibleArrow = true) {
|
||||||
const { proxy } = getCurrentInstance() as any
|
const { proxy } = getCurrentInstance() as any
|
||||||
const popStyle = ref<string>('')
|
const popStyle = ref<string>('')
|
||||||
const arrowStyle = ref<string>('')
|
const arrowStyle = ref<string>('')
|
||||||
@ -80,7 +80,7 @@ export function usePopover() {
|
|||||||
offset: number | number[] | Record<'x' | 'y', number>
|
offset: number | number[] | Record<'x' | 'y', number>
|
||||||
) {
|
) {
|
||||||
// arrow size
|
// arrow size
|
||||||
const arrowSize = 9
|
const arrowSize = visibleArrow ? 9 : 0
|
||||||
// 上下位(纵轴)对应的距离左边的距离
|
// 上下位(纵轴)对应的距离左边的距离
|
||||||
const verticalX = width.value / 2
|
const verticalX = width.value / 2
|
||||||
// 上下位(纵轴)对应的距离底部的距离
|
// 上下位(纵轴)对应的距离底部的距离
|
||||||
|
|||||||
@ -76,7 +76,7 @@ const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'c
|
|||||||
const queue = inject<Queue | null>(queueKey, null)
|
const queue = inject<Queue | null>(queueKey, null)
|
||||||
const selector: string = 'popover'
|
const selector: string = 'popover'
|
||||||
const { proxy } = getCurrentInstance() as any
|
const { proxy } = getCurrentInstance() as any
|
||||||
const popover = usePopover()
|
const popover = usePopover(props.visibleArrow)
|
||||||
|
|
||||||
const showPopover = ref<boolean>(false) // 控制popover显隐
|
const showPopover = ref<boolean>(false) // 控制popover显隐
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ import { tooltipProps, type TooltipExpose } from './types'
|
|||||||
const props = defineProps(tooltipProps)
|
const props = defineProps(tooltipProps)
|
||||||
const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'close'])
|
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 queue = inject<Queue | null>(queueKey, null)
|
||||||
const selector: string = 'tooltip'
|
const selector: string = 'tooltip'
|
||||||
const { proxy } = getCurrentInstance() as any
|
const { proxy } = getCurrentInstance() as any
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user