//元素
<el-upload
class="upload-demo"
ref="upload"
:limit="1"
:http-request="ImgUploadSectionFile"
:with-credentials="true" :auto-upload="true"
accept=".png, .jpg, .gif, .svg" action>
<el-button slot="trigger" type="primary">选取图片</el-button>
</el-upload>
//data
data(){
return {
myfile: "",
imgSrc: "
}
}
//方法
ImgUploadSectionFile(param) {
this.myfile = param.file
console.log(param)
this.imgSrc = URL.createObjectURL(param.file)
// console.log(this.imgSrc)
},
//连接后台接口
formdata.append("id", this.ruleForm.id) //这里是我表格中的每条数据对应的id
formdata.append("file", this.myfile)
axios.post(getRootPath() + "projectInfoController/updataProjectInfoById", formdata).then(res => {
// console.log(res)
})
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- efsc.cn 版权所有 赣ICP备2024042792号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务