Skip to content

Commit

Permalink
tabs和search组件参数单位优化处理
Browse files Browse the repository at this point in the history
  • Loading branch information
wlxuqu committed Jan 24, 2022
1 parent 198c1bb commit 968c089
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion uni_modules/uview-ui/components/u-search/u-search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
backgroundColor: bgColor,
borderRadius: shape == 'round' ? '100px' : '4px',
borderColor: borderColor,
height: height + 'rpx'
height: $u.addUnit(height)
}"
>
<template v-if="$slots.label || label !== null">
Expand Down Expand Up @@ -47,6 +47,7 @@
textAlign: inputAlign,
color: color,
backgroundColor: bgColor,
height: $u.addUnit(height)
}, inputStyle]"
/>
<view
Expand Down
12 changes: 2 additions & 10 deletions uni_modules/uview-ui/components/u-tabs/u-tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,8 @@
let lineOffsetLeft = this.list
.slice(0, this.innerCurrent)
.reduce((total, curr) => total + curr.rect.width, 0);
let lineWidth = this.lineWidth; // 拷贝副本,防止间接修改props中的值
// 如果lineWidth不是数字类型的话
if (typeof lineWidth !== 'number') {
// 判断后缀是否为rpx
if (lineWidth.indexOf('rpx') > -1) {
lineWidth = uni.upx2px(parseFloat(lineWidth)); // rpx -> px
} else {
lineWidth = parseFloat(lineWidth);
}
}
// 获取下划线的数值px表示法
const lineWidth = uni.$u.getPx(this.lineWidth);
this.lineOffsetLeft = lineOffsetLeft + (tabItem.rect.width - lineWidth) / 2
// #ifdef APP-NVUE
// 第一次移动滑块,无需过渡时间
Expand Down

0 comments on commit 968c089

Please sign in to comment.