vue

iview upload 动态改变上传参数

2018-07-25  本文已影响3648人  他大舅啊
          <Upload
              ref="upload"
                :show-upload-list="false"
                :on-success="handleSuccess"
                :format="['jpg']"
                :max-size="10240"
                :on-format-error="handleFormatError"
                :on-exceeded-size="exceededSize"
                :on-progress="progress"
                :before-upload="beforeUpload"  
                :data="uploadData"       //上传参数
                multiple
                type="drag"
                :action="action"      //接口路径
                :class="{inline:btnInfo}">
                <Button type="success" icon="upload" v-if="btnInfo">{{btnInfo}}</Button>
                <div style="padding: 20px 0" v-if="!btnInfo">
                    <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
                    <p>{{title}}</p>
                </div>
            </Upload>
//上传之前
      beforeUpload(){
            this.uploadData = this.paramsToken();
            let promise = new Promise((resolve) => {
                this.$nextTick(function () {
                    resolve(true);
                });
            });
            return promise; //通过返回一个promis对象解决
            
        },
上一篇 下一篇

猜你喜欢

热点阅读