view部份
<image v-if="art.more.thumbnail!=undefined" mode="widthFix" :src='getImage(art.more.thumbnail)'></image>
//数据还没有加载完成就渲染了这样会被出现警告,加v-if就可以不被警告了。
script部份
methods: {
getImage(image) {
let reg = /^http[s]?:\/\/.*/.test(image)
let imageUrlHost="http://www.xxx.com" //本地路径主机
if (reg) {
return image
} else {
return imageUrlHost + image;
}
}
}