From 8361916ff9dc6955cffd0ac739cc6e138d339ce7 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Mon, 15 Jan 2024 18:22:20 +0800 Subject: [PATCH] fix(Navbar): unit use rpx --- src/navbar/navbar.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/navbar/navbar.ts b/src/navbar/navbar.ts index 1f1b59fff..dfe5484e6 100644 --- a/src/navbar/navbar.ts +++ b/src/navbar/navbar.ts @@ -75,13 +75,13 @@ export default class Navbar extends SuperComponent { const boxStyleList = []; const { statusBarHeight } = wx.getSystemInfoSync(); - boxStyleList.push(`--td-navbar-padding-top:${statusBarHeight}px`); + boxStyleList.push(`--td-navbar-padding-top:${statusBarHeight * 2}rpx`); if (rect && res?.windowWidth) { - boxStyleList.push(`--td-navbar-right:${res.windowWidth - rect.left}px`); // 导航栏右侧小程序胶囊按钮宽度 + boxStyleList.push(`--td-navbar-right:${(res.windowWidth - rect.left) * 2}rpx`); // 导航栏右侧小程序胶囊按钮宽度 } - boxStyleList.push(`--td-navbar-capsule-height: ${rect.height}px`); // 胶囊高度 - boxStyleList.push(`--td-navbar-capsule-width: ${rect.width}px`); // 胶囊宽度 - boxStyleList.push(`--td-navbar-height: ${(rect.top - statusBarHeight) * 2 + rect.height}px`); + boxStyleList.push(`--td-navbar-capsule-height: ${rect.height * 2}rpx`); // 胶囊高度 + boxStyleList.push(`--td-navbar-capsule-width: ${rect.width * 2}rpx`); // 胶囊宽度 + boxStyleList.push(`--td-navbar-height: ${((rect.top - statusBarHeight) * 2 + rect.height) * 2}rpx`); this.setData({ boxStyle: `${boxStyleList.join('; ')}`, });