From 1bc8c44665547d15400a98815ed3b42ff6643090 Mon Sep 17 00:00:00 2001 From: liuxiaohang <283700113@qq.com> Date: Thu, 19 Nov 2020 11:38:15 +0800 Subject: [PATCH] =?UTF-8?q?update(h5):=20=20tabbar=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E9=85=8D=E7=BD=AE=EF=BC=8CborderStyle?= =?UTF-8?q?=E3=80=81blurEffect=E3=80=81fontSize=E3=80=81iconWidth=E3=80=81?= =?UTF-8?q?spacing=E3=80=81height=E3=80=81midButton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/platforms/h5.js | 4 +- src/platforms/h5/components/app/tabBar.vue | 201 ++++++++++++++---- src/platforms/h5/components/page/pageBody.vue | 51 +++-- 3 files changed, 186 insertions(+), 70 deletions(-) diff --git a/packages/webpack-uni-pages-loader/lib/platforms/h5.js b/packages/webpack-uni-pages-loader/lib/platforms/h5.js index 1dd4fb8bc..cc55d4434 100644 --- a/packages/webpack-uni-pages-loader/lib/platforms/h5.js +++ b/packages/webpack-uni-pages-loader/lib/platforms/h5.js @@ -57,7 +57,7 @@ const getPageComponents = function (inputDir, pagesJson) { if (tabBarList.length) { // 添加全部属性,方便 Vue 响应式 pagesJson.tabBar.color = pagesJson.tabBar.color || '#999' pagesJson.tabBar.selectedColor = pagesJson.tabBar.selectedColor || '#007aff' - pagesJson.tabBar.backgroundColor = pagesJson.tabBar.backgroundColor || '#f7f7fa' + pagesJson.tabBar.backgroundColor = pagesJson.tabBar.backgroundColor || '' pagesJson.tabBar.borderStyle = pagesJson.tabBar.borderStyle || 'black' } @@ -458,4 +458,4 @@ ${genRegisterPageVueComponentsCode(pageComponents)} global.__uniRoutes=[${genPageRoutes(pageComponents).concat(genSystemRoutes()).join(',')}] global.UniApp && new global.UniApp(); ` -} +} diff --git a/src/platforms/h5/components/app/tabBar.vue b/src/platforms/h5/components/app/tabBar.vue index 29216315e..aa12265e0 100644 --- a/src/platforms/h5/components/app/tabBar.vue +++ b/src/platforms/h5/components/app/tabBar.vue @@ -1,44 +1,72 @@ @@ -90,7 +121,6 @@ uni-tabbar .uni-tabbar~.uni-placeholder { width: 100%; - height: 50px; margin-bottom: 0; margin-bottom: constant(safe-area-inset-bottom); margin-bottom: env(safe-area-inset-bottom); @@ -113,7 +143,6 @@ uni-tabbar .uni-tabbar__bd { position: relative; - height: 50px; display: flex; flex-direction: column; align-items: center; @@ -125,8 +154,6 @@ position: relative; display: inline-block; margin-top: 5px; - width: 24px; - height: 24px; } uni-tabbar .uni-tabbar__icon.uni-tabbar__icon__diff { @@ -144,7 +171,6 @@ position: relative; text-align: center; font-size: 10px; - line-height: 1.8; } uni-tabbar .uni-tabbar-border { @@ -179,10 +205,23 @@ text-align: center; white-space: nowrap; } + + uni-tabbar .uni-tabbar__mid { + display: flex; + justify-content: center; + position: absolute; + bottom: 0; + background-size: 100% 100%; + } + diff --git a/src/platforms/h5/components/page/pageBody.vue b/src/platforms/h5/components/page/pageBody.vue index fc0adc045..57fcc937e 100644 --- a/src/platforms/h5/components/page/pageBody.vue +++ b/src/platforms/h5/components/page/pageBody.vue @@ -18,28 +18,6 @@ uni-page-head[uni-page-head-type="default"] ~ uni-page-wrapper { height: calc(100% - 44px - env(safe-area-inset-top)); } -.uni-app--showtabbar uni-page-wrapper { - display: block; - height: calc(100% - 50px); - height: calc(100% - 50px - constant(safe-area-inset-bottom)); - height: calc(100% - 50px - env(safe-area-inset-bottom)); -} - -.uni-app--showtabbar uni-page-wrapper::after { - content: ""; - display: block; - width: 100%; - height: 50px; - height: calc(50px + constant(safe-area-inset-bottom)); - height: calc(50px + env(safe-area-inset-bottom)); -} - -.uni-app--showtabbar uni-page-head[uni-page-head-type="default"] ~ uni-page-wrapper { - height: calc(100% - 44px - 50px); - height: calc(100% - 44px - constant(safe-area-inset-top) - 50px - constant(safe-area-inset-bottom)); - height: calc(100% - 44px - env(safe-area-inset-top) - 50px - env(safe-area-inset-bottom)); -} - uni-page-body { display: block; box-sizing: border-box; @@ -47,7 +25,34 @@ uni-page-body { } -- GitLab