From a6b336fe7a92041a6eb527dad6b29a34d858b9a5 Mon Sep 17 00:00:00 2001 From: HRK <119110706+18148764734@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:55:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20tooltip=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E5=AF=BC=E8=87=B4=E7=9A=84=E9=94=99?= =?UTF-8?q?=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uni-tooltip/changelog.md | 2 ++ .../components/uni-tooltip/uni-tooltip.vue | 22 +++++++++---------- uni_modules/uni-tooltip/package.json | 5 +++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/uni_modules/uni-tooltip/changelog.md b/uni_modules/uni-tooltip/changelog.md index 1c6d623b..4c9487ad 100644 --- a/uni_modules/uni-tooltip/changelog.md +++ b/uni_modules/uni-tooltip/changelog.md @@ -1,3 +1,5 @@ +## 0.2.4(2024-04-23) +- 修复 弹出位置默认值不一致导致的错位 ## 0.2.3(2024-03-20) - 修复 弹出位置修正 ## 0.2.2(2024-01-15) diff --git a/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue b/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue index 509aaf14..890d767d 100644 --- a/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue +++ b/uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue @@ -5,7 +5,8 @@ {{content}} - + + @@ -25,8 +26,7 @@ }; }, - methods: { - }, + methods: {}, computed: { initPlacement() { let style = {}; @@ -35,7 +35,7 @@ style = { top: '50%', transform: 'translateY(-50%)', - right: '100%', + right: '100%', "margin-right": '10rpx', } break; @@ -43,7 +43,7 @@ style = { top: '50%', transform: 'translateY(-50%)', - left: '100%', + left: '100%', "margin-left": '10rpx', } break; @@ -51,7 +51,7 @@ style = { bottom: '100%', transform: 'translateX(-50%)', - left: '50%', + left: '50%', "margin-bottom": '10rpx', } break; @@ -59,12 +59,12 @@ style = { top: '100%', transform: 'translateX(-50%)', - left: '50%', + left: '50%', "margin-top": '10rpx', } break; } - return style; + return Object.entries(style).map(([key, value]) => `${key}: ${value}`).join('; '); } }, props: { @@ -75,7 +75,7 @@ placement: { type: String, - default: 'left' + default: 'bottom' }, } } @@ -84,7 +84,7 @@