Page 1 of 1

面板小程序tabbar图标不显示

Posted: 2024年 Oct 30日 12:30
by bibaoy

export const tabBar: TabBar = {
borderStyle: "white",
textColor: "#000",
selectedColor: "#fa5500",
list: [
{
// id: "home",
route: "/",
text: "Home",
icon: "/src/res/image/coldopen1.png",
activeIcon: "/src/res/image/coldopen.png",
pagePath: "/pages/home/index",
},
{
route: "/history",
text: "Setting",
icon: "/src/res/image/hotopen1.png",
activeIcon: "/src/res/image/hotopen.png",
pagePath: "/pages/history/index",
},
],
};


Re: 面板小程序tabbar图标不显示

Posted: 2024年 Oct 30日 14:15
by muhai

图标放的路径不对。icon和activeIcon图标必须放在public/images目录下,activeIcon引用的路径是"/images/hotopen.png",例如

Code: Select all

export const tabBar: TabBar = {
  borderStyle: 'white',
  textColor: '#000',
  selectedColor: '#fa5500',
  list: [
    {
      route: '/',
      text: 'Home',
      icon: '/images/icon_back.png', // 必须为 /images 开头,图片放在 /public/images目录下
      activeIcon: '/images/icon_back.png', // 必须为 /images 开头,图片放在 /public/images目录下
      pagePath: '/pages/Home/index',
    },
    {
      route: '/history',
      text: 'Setting',
      icon: '/images/icon_back.png', // 必须为 /images 开头,图片放在 /public/images目录下
      activeIcon: '/images/icon_back.png', // 必须为 /images 开头,图片放在 /public/images目录下
      pagePath: '/pages/history/index',
    },
  ],
};

图片放在 根目录下 public目录中

截屏2024-10-30 14.15.06.png

Re: 面板小程序tabbar图标不显示

Posted: 2024年 Oct 30日 14:24
by bibaoy

ok,可以了,感谢!