s***@126.com
s***@126.com
  • 发布:2023-06-01 16:45
  • 更新:2023-06-01 16:51
  • 阅读:145

tabBar 图片不显示

分类:uni-app

我的项目是用命令行创建的 vue3 的,在开发环境的时候,遇到pages.json 配置tabBar的iconPath,selectedIconPath 路径为 static/,不显示图片,如果在static 前加上src 就可以显示(src/static/),这是为什么 是什么地方配置错误了吗 ?

这是 控制台的报错,图片显示的路径

2023-06-01 16:45 负责人:无 分享
已邀请:
piaoyi_UI

piaoyi_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序

看看pages.json代码以及图片放置目录

  • s***@126.com (作者)

    {  
    "easycom": {
    "autoscan": true,
    "custom": {
    "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
    }
    },
    "pages": [
    {
    "path": "pages/index/index",
    "style": {
    "navigationBarTitleText": "Auto Parts Mall",
    "navigationBarBackgroundColor": "#000000",
    "backgroundColor": "#000000",
    "app-plus": {
    "background": "#000000",
    "titleNView": {
    "backgroundColor": "#000000",
    "titleColor": "#FFFFFF"
    }
    }
    }
    },
    {
    "path": "pages/login/index",
    "style": {
    "navigationBarTitleText": "登录",
    "navigationStyle": "custom"
    }
    },
    {
    "path": "pages/password/index",
    "style": {
    "navigationBarTitleText": "Forgot Password?"
    }
    },
    {
    "path": "pages/password/verify-code",
    "style": {
    "navigationBarTitleText": "Forgot Password?",
    "navigationBarBackgroundColor": "#FFFFFF",
    "app-plus": {
    "titleNView": {
    "titleColor": "#000000",
    "titleSize": "35rpx"
    }
    }
    }
    },
    {
    "path": "pages/register/index",
    "style": {
    "navigationBarTitleText": "Sign up for free",
    "enablePullDownRefresh": true
    }
    },
    {
    "path": "pages/category/index",
    "style": {
    "navigationBarTitleText": "Auto Parts Mall",
    "app-plus": {
    "titleNView": {
    "autoBackButton": false
    }
    }
    }
    },
    {
    "path": "pages/my/index",
    "style": {
    "navigationBarTitleText": "",
    "enablePullDownRefresh": true
    }
    },
    {
    "path": "pages/inventory/index",
    "navigationBarTitleText": "Modification List",
    "navigationBarBackgroundColor": "#000000",
    "backgroundColor": "#000000",
    "app-plus": {
    "background": "#000000",
    "titleNView": {
    "backgroundColor": "#000000",
    "titleColor": "#FFFFFF"
    }
    }
    },
    {
    "path": "pages/model-detail/index",
    "style": {
    "navigationBarTitleText": "",
    "navigationBarBackgroundColor": "#FFFFFF",
    "app-plus": {
    "titleNView": {
    "titleColor": "#000000",
    "titleSize": "35rpx"
    }
    }
    }
    },
    {
    "path": "pages/cast-detail/index",
    "style": {
    "navigationBarTitleText": "Case Details",
    "navigationBarBackgroundColor": "#FFFFFF",
    "app-plus": {
    "titleNView": {
    "titleColor": "#000000",
    "titleSize": "35rpx"
    }
    }
    }
    },
    {
    "path": "pages/product-detail/index",
    "style": {
    "navigationBarTitleText": "Product Details",
    "navigationBarBackgroundColor": "#FFFFFF",
    "app-plus": {
    "titleNView": {
    "titleColor": "#000000",
    "titleSize": "35rpx"
    }
    }
    }
    },
    {
    "path": "pages/reset-password/index",
    "style": {
    "navigationBarTitleText": "Rest Password",
    "navigationBarBackgroundColor": "#FFFFFF",
    "app-plus": {
    "titleNView": {
    "titleColor": "#000000",
    "titleSize": "35rpx"
    }
    }
    }
    }
    ],
    "globalStyle": {
    "navigationBarTextStyle": "white",
    "navigationBarTitleText": "Auto Parts Mall",
    "navigationBarBackgroundColor": "#000000",
    "backgroundColor": "#000000"
    },
    "tabBar": {
    "color": "#656565",
    "selectedColor": "#F4B653",
    "backgroundColor": "white",
    "height": "120rpx",
    "list": [
    {
    "pagePath": "pages/index/index",
    "text": "Home",
    "iconPath": "static/tabBar/home.png",
    "selectedIconPath": "static/tabBar/home-ed.png"
    },
    {
    "pagePath": "pages/category/index",
    "text": "Brand model",
    "iconPath": "static/tabBar/category.png",
    "selectedIconPath": "static/tabBar/category-ed.png"
    },
    {
    "pagePath": "pages/inventory/index",
    "text": "Modification List",
    "iconPath": "static/tabBar/inventory.png",
    "selectedIconPath": "static/tabBar/inventory-ed.png"
    },
    {
    "pagePath": "pages/my/index",
    "text": "Brand model",
    "iconPath": "static/tabBar/my.png",
    "selectedIconPath": "static/tabBar/my-ed.png"
    }
    ]
    }
    }

    2023-06-07 07:02

  • piaoyi_UI

    回复 s***@126.com: 配置没啥问题,图片位置对不对

    2023-06-07 09:43

要回复问题请先登录注册