- 关于文件上传wx.uploadFile的用法?
for(var i=0;i<len;i++){ var $path=$files[i].path; wx.uploadFile({ url:app.globalData.api+"&r=util.uploader.upload&file=file", filePath:$path, name:"file",//规定的key值 header: { "Content-Type": "multipart/form-data" }, success:function(res){ console.log(JSON.parse(res.data)); console.log(JSON.parse(res.data).files[0].url) console.log(JSON.parse(res.data).files[0].filename) successNum++; console.log(successNum) arr.push({ url:JSON.parse(res.data).files[0].url, filename:JSON.parse(res.data).files[0].filename }); console.log(arr.length); console.log(arr) if(arr.length==successNum){ console.log(that.data.id) o.post("member/cart/addsd",{ id:that.data.id,//会员id files:arr,//文件列表 title:that.data.id.title,//原产品详情 gid:that.data.gid,//原产品id },function(res){ console.log(res); if(res==1){ wx.switchTab({ url:"/pages/member/cart/index" }); } }) /* wx.navigateTo({ url:"/pages/member/cart/index?id="+that.data.id }) */ }else{ console.log("没有上传完成") } } }) }; d我现在要上传多个文件,但是wx.uploadFile api只能上传一个文件,于是我便用了循环上传写法,但是实际操作中,比如上传两张图片,第一张图片会自动多上传一次 咋处理
2021-04-07 - 小程序图片裁剪插件 image-cropper 不能缩放图片?
<view class="container"> <image-cropper id="image-cropper" limit_move="{{true}}" disable_rotate="{{true}}" width="{{width}}" height="{{height}}" imgSrc="{{src}}" bindload="cropperload" bindimageload="loadimage" bindtapcut="clickcut" angle="0" scale="2"></image-cropper> <view class="true" bindtap="trues"><button type="primary" class="auto">确定</button></view> </view> 我这个scale缩小属性 不管设置多少,收几张查看的效果是一毛一样的 咋回事 y要咋样改 才能控制图片缩小比例
2021-04-06 - 发现一个bug问题,看不懂为什么会出现这种情况?
js代码 [图片] 调试打印 [图片][图片] 可以此段代码 执行的是第一个条件 为何data数据中却是false; [图片]
2021-03-26 - 请教一下大家 小程序哪个组件能获取手机的文件?包括txt wps文件等,有的话 有没有代码dome
请教一下大家 小程序哪个组件能获取手机的文件?包括txt wps文件等,有的话 有没有代码dome
2021-03-18