el-upload点击打开文件上传弹窗之前进行其他操作,等待操作完成后再打开文件上传弹窗

578 阅读1分钟

el-upload点击打开文件上传弹窗之前进行其他操作,等待操作完成后再打开文件上传弹窗

el-upload点击打开文件上传弹窗之前进行其他操作,等待操作完成后再打开文件上传弹窗_el-upload点击事件_不想学习只想玩的博客-CSDN博客 下面这一行代码是控制打开文件上传弹窗

<el-button class="btnUpload" ref="upload1"></el-button>

通过"importDoc"判断是否满足打开文件上传的窗口

 <el-button @click="importDoc" size="mini" type="primary">选择文件</el-button>
<el-upload class="upload-demo" action="#" accept=".xlsx" :multiple="false" :limit="1"
                        :on-change="handleChange" :show-file-list='true' :file-list="fileList" :auto-upload="false"
                        :before-remove="beforeRemove" :on-exceed="handleExceed" list-type="text">
                        <el-button class="btnUpload" ref="upload1"></el-button>
                        <el-button size="mini" type="primary">选择文件</el-button>
                    </el-upload>
 importDoc() {
  if (这里写打开文件上传窗口的条件) {
            this.$refs["upload1"].$el.click(); //打开上传文件弹窗
            }else{
            //不满足上传条件
            }
        },