• element ui图片上传方法


              <!--商品图片-->
              <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);
              }
            })
          }
        },
    

      

  • 相关阅读:
    JQ之html,text,val
    JQuery之编写弹窗
    DOM操作HTML元素属性
    DOM操作表格
    无缝滚动效果
    Date日期基础
    CISSP备考总结
    CISA考试大纲即将更新
    备考CISSP
    cisa备考体会
  • 原文地址:https://www.cnblogs.com/guiyishanren/p/13778719.html
Copyright © 2020-2023  润新知