使用oppo r9s无法显示小程序组件
- 当前 Bug 的表现(可附上截图)
图片无法上传和加载
1.1 图片上传时(可复现图片截图)
1.2图片加载时(可复现图片截图)
- 预期表现
1.1 预期上传图片时(使用华为,apple,三星等其他手机测试均正常)——上传过程中
1.2 预期上传完成后的加载效果(使用华为,apple,三星等其他手机测试均正常)——加载显示
- 复现路径
微信小程序提供的原生组件wx.uploadFile
- 提供一个最简复现 Demo
//点击上传事件 uploadimage: function () { var value = wx.getStorageSync( 'xxxxxx' ); var that = this ; var upload_picture_list = this .data.upload_picture_list; //循环把图片上传到服务器 并显示进度 for ( var j in upload_picture_list) { if (upload_picture_list[j][ 'upload_percent' ] == 0) { //调用函数 // var url = urls_upload; var url = 'xxxxxxxx' ; that.upload_file_server(url, upload_picture_list, j) } } wx.hideToast();
//上传方法 upload_file_server: function (url, upload_picture_list, j) { //上传返回值 var that = this ; const upload_task = wx.uploadFile({ url: url, //需要用HTTPS,同时在微信公众平台后台添加服务器地址 filePath: upload_picture_list[j][ 'path' ], //上传的文件本地地址 name: 'file' , formData: { 'num' : j }, //附近数据,这里为路径 success: function (res) { var data = JSON.parse(res.data); if (data.err == 0) { var filenamePicUrl = data.rows.PicUrl //存储地址 显示 var filenameSaveUrl = data.rows.SaveUrl //存储地址 显示 upload_picture_list[j][ 'PicUrl' ] = filenamePicUrl upload_picture_list[j][ 'SaveUrl' ] = 'xxxxxxxxxx' + filenameSaveUrl that.setData({ upload_picture_list: upload_picture_list }); } }
//上传 进度方法 upload_task.onProgressUpdate((res) => { upload_picture_list[j][ 'upload_percent' ] = res.progress that.setData({ upload_picture_list: upload_picture_list }); });
|
微信小程序
appid:wx1104913fafd2287f
建议开发者先加个fail回调处理下