feat 配置tabBar

This commit is contained in:
Ironsp
2026-08-31 10:54:56 +08:00
parent 77753f513e
commit 20783bbfc1
10 changed files with 62 additions and 14 deletions

View File

@@ -19,22 +19,22 @@ export default defineUniPages({
selectedColor: '@tabSelectedColor', selectedColor: '@tabSelectedColor',
list: [ list: [
{ {
pagePath: 'pages/index', pagePath: 'pages/home/index',
text: '首页', text: '首页',
iconPath: 'static/vite.png', iconPath: 'static/home.png',
selectedIconPath: 'static/vite.png', selectedIconPath: 'static/home1.png',
}, },
{ {
pagePath: 'pages/hi', pagePath: 'pages/work/index',
text: '我的', text: '工作',
iconPath: 'static/vite.png', iconPath: 'static/work.png',
selectedIconPath: 'static/vite.png', selectedIconPath: 'static/work1.png',
}, },
{ {
pagePath: 'pages/hi', pagePath: 'pages/report/index',
text: 'about', text: '报告',
iconPath: 'static/vite.png', iconPath: 'static/report.png',
selectedIconPath: 'static/vite.png', selectedIconPath: 'static/report1.png',
}, },
], ],
}, },

View File

@@ -1,3 +1,51 @@
<script setup lang="ts"> <script setup lang="ts">
onLaunch(() => {}) onLaunch(() => {})
</script> </script>
<style>
/* #ifdef H5 */
uni-tabbar {
--uni-tabbar-height: 50px;
}
uni-tabbar .uni-tabbar__icon {
height: 24px !important;
width: 24px !important;
}
uni-tabbar .uni-tabbar__icon img {
height: 24px !important;
width: 24px !important;
}
uni-tabbar .uni-tabbar__label {
font-size: 10px !important;
margin-top: 2px !important;
}
/* #endif */
/* #ifdef APP-PLUS */
uni-tabbar {
height: 50px !important;
}
uni-tabbar .uni-tabbar__content {
height: 50px !important;
}
uni-tabbar .uni-tabbar__icon {
height: 24px !important;
width: 24px !important;
}
uni-tabbar .uni-tabbar__icon img {
height: 24px !important;
width: 24px !important;
}
uni-tabbar .uni-tabbar__label {
font-size: 10px !important;
margin-top: 2px !important;
}
/* #endif */
</style>

BIN
src/static/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

BIN
src/static/home1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

BIN
src/static/report.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/static/report1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/static/work.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src/static/work1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -9,7 +9,7 @@
"tabBgColor": "#fcfcfc", "tabBgColor": "#fcfcfc",
"tabBorderStyle": "black", "tabBorderStyle": "black",
"tabFontColor": "#1f2937", "tabFontColor": "#1f2937",
"tabSelectedColor": "#ff6b00" "tabSelectedColor": "#4685FD"
}, },
"dark": { "dark": {
"bgColor": "#181818", "bgColor": "#181818",
@@ -21,6 +21,6 @@
"tabBgColor": "#181818", "tabBgColor": "#181818",
"tabBorderStyle": "white", "tabBorderStyle": "white",
"tabFontColor": "#f3f4f6", "tabFontColor": "#f3f4f6",
"tabSelectedColor": "#ff6b00" "tabSelectedColor": "#4685FD"
} }
} }

2
src/uni-pages.d.ts vendored
View File

@@ -14,7 +14,7 @@ interface NavigateToOptions {
interface RedirectToOptions extends NavigateToOptions {} interface RedirectToOptions extends NavigateToOptions {}
interface SwitchTabOptions { interface SwitchTabOptions {
url: "/pages/index" | "/pages/hi" | "/pages/hi" url: "/pages/home/index" | "/pages/work/index" | "/pages/report/index"
} }
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions; type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;