Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

element上传问题

### 问题描述
需求:前端实现上传apk文件
### 问题出现的环境背景及自己尝试过哪些方法
上传失败,且在devtools中不显示status和method
image.png
image.png
image.png

### 相关代码
el-uplaod代码
<el-upload

      ref="upload"
      :file-list="fileList"
      action="/api/common/update-apk"
      :headers="headers"
      :data="params"
      :on-error="handleError"
      :on-success="handleSuccess"
      :auto-upload="false"
      drag
    >
      <i class="el-icon-upload"></i>
      <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
      <div class="el-upload__tip" slot="tip">
        只能上传apk文件.
      </div>
    </el-upload>
    
    
    data() {
        return {
            fileList: [],
            headers: {},
            params: { version: "1.2.5" }
        }
    

发布函数
publish() {

  this.params.version = this.form.version;
  this.$nextTick(() => {
    this.$refs.upload.submit();
  });
},

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

让服务端设置同源策略即可


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...