element ui 中 下载的使用

在工作用到 el-upload 上传,这块有封装好的,是form表单上传,记录一下运用的

   <el-upload
                style="display: inline-block"
                class="upload-demo"
                action="xxxxxxxxxx"
                name="remarkFile"
                :show-file-list = false
                :on-success="uploadSuccess"
                :on-error="uploadError"
        >

            uploadSuccess(data){
                if(data.code === 1){
                    this.$message.success(data.data) //成功的消息通知
                }else{
                    this.$message.error(data.message) //失败的消息通知
                }
            },
            uploadError(err) {
                this.$message.error(data.data)
            },
action 是请求地址
show-file-list 是否开启本地存储
name 请求的 字段参数
on-success 成功的方法
on-error 失败的方法
posted @ 2021-09-26 10:54  打个大大西瓜  阅读(6)  评论(0)    收藏  举报