在vue中怎么才能根据后台返回不同的文字渲染不同的图片呢?
根据不同的文字状态,页面上给出不同的图片
我是这样写的
{{item.name}}
{{item.status}}
color(col){
// if(col.status=="已完成") return "#FFD700"
// if(col.status=="执行中") return "green"
// if(col.status=="待执行") return "gray"
// return "black"
if(col.status=="已完成"){
return this.statusimage="../assets/img6.png"
}
if(col.status=="执行中"){
return this.statusimage="../assets/image7.png"
}
if(col.status=="待执行"){
return this.statusimage="../assets/image5.png"
}
},
不同的文字颜色不同是可以实现的,为什么不同的图片不行呢? 页面报错
这是为什么呢 怎么写呢?
根据不同的文字渲染不同的图片