1. 照片墙上传照片,上传一张之后,上传框就消失
上传之后,右边的这个框就隐藏,方法是借鉴github
上的,链接忘记了,后面想起来了补上
在el-upload
标签上添加一个::class="{ hide: ruleForm.hideUpload_introduce }"
,动态的class
data
里面:
ruleForm: {
hideUpload_introduce: false,
limitCount: 1,
},
同时在el-upload上的两个钩子添加事件:on-change="handleIntroduceUploadHide",注意,如果我们要删除照片,删除之后,是希望上传框出现的,所以还要:on-remove="handleIntroduceRemove",在删除时触发事件,显示上传框
methods里面:
handleIntroduceUploadHide(file, fileList) {
this.ruleForm.hideUpload_introduce =
fileList.length >= this.ruleForm.limitCount;
},
handleIntroduceRemove(file, fileList) {
this.ruleForm.hideUpload_introduce =
fileList.length >= this.ruleForm.limitCount;
},
style
里面:
/deep/.hide .el-upload--picture-card {
display: none;
}