使用v-for遍历图片发现没有报错、图片也没有加载
tabs: [
{
icon: "./assets/images/icon/home.png",
title: "首页",
iconActive: "./assets/images/icon/home_active.png"
},
{
icon: "./assets/images/icon/menu.png",
title: "分类",
iconActive: "./assets/images/icon/menu_active.png"
},
{
icon: "./assets/images/icon/shoppingcar.png",
title: "购物车",
iconActive: "./assets/images/icon/shoppingcar_active.png"
},
{
icon: "./assets/images/icon/account.png",
title: "我的",
iconActive: "./assets/images/icon/account_active.png"
}
]
解决办法,使用require引入
tabs: [
{
icon: require('./assets/images/icon/home.png'),
title: "首页",
iconActive: require('./assets/images/icon/home_active.png')
},
{
icon: require('./assets/images/icon/menu.png'),
title: "分类",
iconActive: require('./assets/images/icon/menu_active.png')
},
{
icon: require('./assets/images/icon/shoppingcar.png'),
title: "购物车",
iconActive: require('./assets/images/icon/shoppingcar_active.png')
},
{
icon: require('./assets/images/icon/account.png'),
title: "我的",
iconActive: require('./assets/images/icon/account_active.png')
}
]