< el-form-item label = " 图片" :rules = " createRules.strRequired" >
< el-upload
class = " upload-demo"
ref = " upload"
multiple
:on-preview = " handlePictureCardPreview"
:on-change = " handlePicChange"
:before-upload = " beforeAvatarUpload"
action = " /admin/uploads/posts?type=1"
:on-remove = " handleRemove"
:file-list = " fileListPic"
limit = " 5"
:auto-upload = " true"
:on-exceed = " handleExceedPic"
accept = " .jpg,.jpeg,.png"
list-type = " picture" >
< el-button slot = " trigger" size = " small" type = " primary" > 选取文件</ el-button>
< div slot = " tip" class = " el-upload__tip" > 只能上传最多五个jpg/png文件,且单个文件不超过1M</ div>
</ el-upload>
</ el-form-item>
return {
fileListPic : [ ] ,
} ,
methods : {
handlePicChange ( file, fileList ) {
this . fileListPic = fileList;
} ,
handlePictureCardPreview ( file ) {
this . dialogImageUrl = file. url