首页 > Web开发 > 详细

mui 的多图片上传

时间:2018-07-31 18:39:25      阅读:455      评论:0      收藏:0      [点我收藏+]
    pickHead(){
      var _this = this;
      plus.gallery.pick(function(path){
        _this.headImage=path;
        var files = [{name:"imgUpload",path:path}]
        var wt=plus.nativeUI.showWaiting();
        var task=plus.uploader.createUpload(url,{method:"POST"},
          function(t,status){
            console.log(t.responseText)
            wt.close();
            if(status==200){
              var r = JSON.parse( t.responseText );
              if(r.code==200){
                _this.userInfor.headImage = r.data;
              }else{
                return
              }
            }else{
              mui.toast(‘网络请求失败!‘)
            }
          }
        );
        task.addData("client","plus");
        task.addData("uid",Math.floor( Math.random()*100000000+10000000).toString());
        for(var i=0;i<files.length;i++){
          var f=files[i];
          task.addFile(f.path,{key:f.name});
        }
        task.start();
 
      }, function(e){
        mui.toast(‘取消选择图片‘);
      }, {filter:‘image‘});
    }

 

mui 的多图片上传

原文:https://www.cnblogs.com/yuanxinru321/p/9396947.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!