当前位置:网站首页>V-for img SRC rendering fails
V-for img SRC rendering fails
2022-07-07 11:08:00 【Have a good time I】
Problem description :
An array is defined , The path with pictures in the array , Use for When the page is rendered in a loop , The picture path is right, but the picture does not show .
terms of settlement : The path of the image in the array should be written as follows :
image:require('../assets/img/login.png')
Write when rendering
<img :src="item.image" />
Specific examples
<a-menu
v-for="(v, i) in navData"
:key="i"
:default-selected-keys="['/account/home']"
:selected-keys="[v.key]"
mode="inline"
type="inner"
class="accout_menu"
@openChange="onOpenChange"
>
<a-menu-item key="v.key">
<router-link :to="{ name: v.name }">
<img :src="v.src" class="menu_account_image" />
<span class="menu_account_title">{
{
v.title }}</span>
</router-link>
</a-menu-item>
</a-menu>
data() {
return{
navData: [
{
key: '/account/home', name: 'account/home', src: require('@/assets/image/account/home.png'), title: ' home page ' },
{
key: '/account/consumptive-volume',
name: 'account/consumptiveVolume',
src: require('@/assets/image/account/consumptiveVolume.png'),
title: ' Card and voucher management '
},
{
key: '/account/order',
name: 'account/order',
src: require('@/assets/image/account/order.png'),
title: ' Order management '
},
{
key: '/account/bill',
name: 'account/bill',
src: require('@/assets/image/account/bill.png'),
title: ' Transaction records '
},
{
key: '/account/community',
name: 'account/community',
src: require('@/assets/image/account/community.png'),
title: ' My circle '
},
{
key: '/account/message',
name: 'account/message',
src: require('@/assets/image/account/message.png'),
title: ' Message center '
},
{
key: '/account/base-setting',
name: 'account/baseSetting',
src: require('@/assets/image/account/baseSetting.png'),
title: ' Account Center '
}
]
}
}
```
边栏推荐
猜你喜欢

Mpx 插件

I plan to take part in security work. How about information security engineers and how to prepare for the soft exam?

Arduino board description

ADB utility commands (network package, log, tuning related)

China Southern Airlines pa3.1

Wallhaven壁纸桌面版

Idea shortcut keys

What does intermediate software evaluator test

Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)

When do you usually get grades in the soft exam? Online pedaling?
随机推荐
[untitled]
2022.7.4DAY596
滚动踩坑--UNI_APP(八)
Monai version has been updated to 0.9. See what new functions it has
A simple example of delegate usage
请问申购新股哪个证券公司开户是最好最安全的
What does intermediate software evaluator test
Unity websocket server
SQL Server 知识汇集11 : 约束
Go-Redis 中间件
【pyqt】tableWidget里的cellWidget使用信号与槽机制
2021 summary and 2022 outlook
在线硬核工具
Deeply understand the characteristics of database transaction isolation
China Southern Airlines pa3.1
Those confusing concepts (3): function and class
2021-05-21
Use of dotween
Is the gold content of intermediate e-commerce division in the soft exam high?
【推荐系统 01】Rechub