x***@163.com
x***@163.com
  • 发布:2019-05-04 23:00
  • 更新:2019-05-05 08:31
  • 阅读:966

image不能动态换图片

分类:uni-app

想做一个logo上传,选择图片之后就想把图片显示在logo的位置 替换掉默认的logo

<view class="input">  
<image style="width: 100upx;height: 100upx;" :src="logo" @tap="uploadAvatar"></image>  
</view>  

data(){

return {
logo:"../../../static/img/missing-face.png",}
}

uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
this.logo = "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png";
console.log(JSON.stringify(res));

                }  

            });  

动态替换图片地址图像没有变化,在线等,求大腿啊

2019-05-04 23:00 负责人:无 分享
已邀请:
Trust

Trust - 少说废话

this 的指向不对,换成箭头函数,建议补充下基础知识。

x***@163.com

x***@163.com (作者)

好的 谢谢哈

该问题目前已经被锁定, 无法添加新回复