小程序白屏问题

4592关注13946浏览

在选择完图片后用七牛的图片上传接口保存图片,返回后会出现白屏情况,但是注释七牛的代码后则不会出现此类情况

chooseImageTap: function (e) {

var _this = this;

var index = e.currentTarget.dataset.index;

wx.showActionSheet({

itemList: ['从相册中选择', '拍照'],

itemColor: "#e61128",

success: function (res) {

if (!res.cancel) {

if (res.tapIndex == 0) {

_this.chooseWxImage('album', index)

} else if (res.tapIndex == 1) {

_this.chooseWxImage('camera', index)

}

}

}

})

},

chooseWxImage: function (type, index) {

let _this = this;

wx.chooseImage({

sizeType: ['original', 'compressed'],

sourceType: [type],

success: function (res) {

var filePath = res.tempFilePaths[0];

console.log('选择完成图片')

// 交给七牛上传

//注释以下代码则不会出现白屏问题

qiniuUploader.upload(filePath, (res) => {

var imageURL = res.imageURL;

console.log('七牛上传完成图片')

if(index==1){

_this.setData({ idCartFront: imageURL});

}else{

_this.setData({ idCartBack: imageURL });

}

}, (error) => {


}, {

region: 'ECN', // 华东区

uptoken: _this.data.uptoken,

domain: 'http://img1.zhefengle.com',

shouldUseQiniuFileName: false

}

);

//注释以上代码则不会出现白屏问题

}

})


展开全部
收起
0回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部