上传图片(照片)
<el-upload
action="" //图片上传的路径
style="text-align:left;margin-left:0px;"
:show-file-list="true" //是否显示已上传文件列表
:on-preview="handlePreview2" //点击文件列表中已上传的文件时的钩子
:limit="6" //可上传的个数
:on-remove="handleRemove2" //文件列表移除文件时的钩子
:file-list="prctureList" //上传的图片 存放的列表
list-type="picture" //文件列表的类型 text/picture/picture-card
:multiple="false" //是否支持多选文件
:auto-upload="false" //是否在选取文件后立即进行上传 boolean
:on-exceed="handleExceed2" //文件超出个数限制时的钩子
v-model="overbackform.picture" //
accept=".png,.jpg,.jpeg,.gif,.bmp,.psd,.tif " //限制上传的格式
>
<el-button size="small" type="primary">点击上传</el-button>
<div style="font-size:12px;">只能上传<span style="color:red;">JPG</span>/<span style="color:red;">PNG</span>格式</div>
</el-upload>
handleRemove2(file, fileList) {
// console.log(file, fileList);
},
handlePreview2(file) {
this.prctureList = []
const h = this.$createElement
this.$notify({
title:"温馨提示",
type:"success",
message:h("i",{style:"color:green"},"移除成功,,,")
})
},
handleExceed2(file,fileList){
this.$notify({
title:"温馨提示",
type:"warning",
message:this.$createElement("i",{style:"color:orange"},"注意最多上传6张图片!!!")
})
}