vue v-for 遍历不能正常显示的问题,
data() {return {imgList:[{imgUrl:'../assets/img/a.png',imgLink:'',type:''},{imgUrl:'../assets/img/b.png',imgLink:'',type:''},{...
·
vue 项目用v-for遍历图片,不能正常显示的问题,
data() {
return {
imgList:[
{
imgUrl:'../assets/img/a.png',
imgLink:'',
type:''
},
{
imgUrl:'../assets/img/b.png',
imgLink:'',
type:''
},
{
imgUrl:'../assets/img/c.png',
imgLink:'',
type:''
},
{
imgUrl:'../assets/img/d.png',
imgLink:'',
type:''
},
{
imgUrl:'../assets/img/e.png',
imgLink:'',
type:''
}
]
废话不多说;
包一个 require( ) 搞定
require('../assets/img/a.png')
data() {
return {
imgList:[
{
imgUrl:require('../assets/img/a.png'),
imgLink:'',
type:''
},
{
imgUrl:require('../assets/img/b.png'),
imgLink:'',
type:''
},
{
imgUrl:require('../assets/img/c.png'),
imgLink:'',
type:''
},
{
imgUrl:require('../assets/img/d.png'),
imgLink:'',
type:''
},
{
imgUrl:require('../assets/img/e.png'),
imgLink:'',
type:''
}
]
更多推荐
已为社区贡献10条内容
所有评论(0)