自定義微信小程序tabBar組件上邊框的顏色

背景:

在微信小程序的實際開發過程中,有時候我們需要修改微信小程序提供的 tabBar 組件頂部邊框的顏色,以滿足項目需求

此圖像的alt屬性爲空;文件名爲image-2.png

 

解決方案:

方式一:

通過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",
      
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章