Skip to content

Commit 3b6d10d

Browse files
authored
fix: 🐛 修复popover tooltip组件visibleArrow=false时弹出框距离元素间距过远的问题 (#792)
Closes: #788
1 parent bdb5653 commit 3b6d10d

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/uni_modules/wot-design-uni/components/composables/usePopover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getCurrentInstance, ref } from 'vue'
22
import { getRect, isObj } from '../common/util'
33

4-
export function usePopover() {
4+
export function usePopover(visibleArrow = true) {
55
const { proxy } = getCurrentInstance() as any
66
const popStyle = ref<string>('')
77
const arrowStyle = ref<string>('')
@@ -80,7 +80,7 @@ export function usePopover() {
8080
offset: number | number[] | Record<'x' | 'y', number>
8181
) {
8282
// arrow size
83-
const arrowSize = 9
83+
const arrowSize = visibleArrow ? 9 : 0
8484
// 上下位(纵轴)对应的距离左边的距离
8585
const verticalX = width.value / 2
8686
// 上下位(纵轴)对应的距离底部的距离

src/uni_modules/wot-design-uni/components/wd-popover/wd-popover.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'c
7676
const queue = inject<Queue | null>(queueKey, null)
7777
const selector: string = 'popover'
7878
const { proxy } = getCurrentInstance() as any
79-
const popover = usePopover()
79+
const popover = usePopover(props.visibleArrow)
8080
8181
const showPopover = ref<boolean>(false) // 控制popover显隐
8282

src/uni_modules/wot-design-uni/components/wd-tooltip/wd-tooltip.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import { tooltipProps, type TooltipExpose } from './types'
4545
const props = defineProps(tooltipProps)
4646
const emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'close'])
4747
48-
const popover = usePopover()
48+
const popover = usePopover(props.visibleArrow)
4949
const queue = inject<Queue | null>(queueKey, null)
5050
const selector: string = 'tooltip'
5151
const { proxy } = getCurrentInstance() as any

0 commit comments

Comments
 (0)