背景:
在微信小程序的實際開發過程中,有時候我們需要修改微信小程序提供的 tabBar 組件頂部邊框的顏色,以滿足項目需求
解決方案:
方式一:
通過tabBar組件自帶的 borderStyle 屬性來控制邊框的顏色,將邊框的顏色設置爲白色,如下代碼:
"borderStyle": "white",
全部代碼:
app.json文件
"tabBar": {
"color": "#7B7E82",
"selectedColor": "#333333",
"borderStyle": "white",
"list": [{
"pagePath": "pages/index/index",
"text": "首頁",
"iconPath": "images/home_default.png",
"selectedIconPath": "images/home_select.png"
},{
"pagePath": "pages/index/index",
"text": "服務預約",
"iconPath": "images/service_default.png",
"selectedIconPath": "images/service_select.png"
},{
"pagePath": "pages/cemetery/cemetery",