Skip to content

Commit

Permalink
fix: tooltip默认值不一致导致的错位问题
Browse files Browse the repository at this point in the history
  • Loading branch information
18148764734 committed Apr 23, 2024
1 parent d77ba37 commit a6b336f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions uni_modules/uni-tooltip/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.2.4(2024-04-23)
- 修复 弹出位置默认值不一致导致的错位
## 0.2.3(2024-03-20)
- 修复 弹出位置修正
## 0.2.2(2024-01-15)
Expand Down
22 changes: 11 additions & 11 deletions uni_modules/uni-tooltip/components/uni-tooltip/uni-tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<slot name="content">
{{content}}
</slot>
</view>
</view>

</view>
</template>

Expand All @@ -25,8 +26,7 @@
};
},
methods: {
},
methods: {},
computed: {
initPlacement() {
let style = {};
Expand All @@ -35,36 +35,36 @@
style = {
top: '50%',
transform: 'translateY(-50%)',
right: '100%',
right: '100%',
"margin-right": '10rpx',
}
break;
case 'right':
style = {
top: '50%',
transform: 'translateY(-50%)',
left: '100%',
left: '100%',
"margin-left": '10rpx',
}
break;
case 'top':
style = {
bottom: '100%',
transform: 'translateX(-50%)',
left: '50%',
left: '50%',
"margin-bottom": '10rpx',
}
break;
case 'bottom':
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: {
Expand All @@ -75,7 +75,7 @@
placement: {
type: String,
default: 'left'
default: 'bottom'
},
}
}
Expand All @@ -84,7 +84,7 @@
<style>
.uni-tooltip {
position: relative;
cursor: pointer;
cursor: pointer;
display: inline-block;
}
Expand All @@ -98,7 +98,7 @@
font-size: 12px;
text-align: left;
line-height: 16px;
padding: 12px;
padding: 12px;
overflow: auto;
}
Expand Down
5 changes: 3 additions & 2 deletions uni_modules/uni-tooltip/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "uni-tooltip",
"displayName": "uni-tooltip 提示文字",
"version": "0.2.3",
"version": "0.2.4",
"description": "Tooltip 提示文字",
"keywords": [
"uni-tooltip",
Expand Down Expand Up @@ -43,7 +43,8 @@
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
"aliyun": "y",
"alipay": "n"
},
"client": {
"Vue": {
Expand Down

0 comments on commit a6b336f

Please sign in to comment.