<!--商品图片--> <template v-slot:product_cover> <el-upload list-type="picture-card" name="cover" accept="image/png, image/jpeg,image/jpg" :multiple="multiple" :action="cover_upload_action" :headers="upload_header" :on-success="cover_upload_success" :on-progress="cover_on_process" :file-list="cover" :on-preview="handlePictureCardPreview" :on-remove="handleRemove" :limit="6" :on-exceed='on_exceed'> <i class="el-icon-plus">添加主图</i> </el-upload> <el-dialog :visible.sync="dialogVisible"> <img width="100%" :src="dialogImageUrl" alt=""> </el-dialog> </template>
cover_upload_success(resp, file, fileList){ console.log(fileList) let is_last = true; fileList.forEach(function(val, index){ if(typeof val.response == "undefined" && !val.hasOwnProperty('img_id')){ is_last = false; } }) if(is_last){ fileList.forEach(function(val){ if(typeof val.response != "undefined") { store.commit('product/PUSH_COVER',val.response.data); } }) } },