1.在main.js文件中,添加以下代码:
复制使用:
// 图片使用网络地址
Vue.prototype.localImgSrc = function(img){
//项目的地址域名,例如百度
return "https://baidu.cn/static/index/images/" + img;
}
2.在页面中直接使用:
<image :src="localImgSrc('[email protected]')" mode=""></image>
复制使用:
// 图片使用网络地址
Vue.prototype.localImgSrc = function(img){
//项目的地址域名,例如百度
return "https://baidu.cn/static/index/images/" + img;
}
<image :src="localImgSrc('[email protected]')" mode=""></image>