图都没上传,点击编辑的时候出现这样的问题
下图是手动去掉,才回有+ ,
代码如下:
<el-upload
action="#"
:limit="1"
v-loading="loading"
list-type="picture-card"
:auto-upload="false"
:class="{ disabled: uploadDisabled }"
accept="image/png, image/jpg, image/jpeg"
:file-list="fileList"
:on-remove="handleRemove"
:on-preview="handleCoverpicture"
:on-change="handleUpUpload"
ref="uploadFile"
>
<i class="el-icon-plus"></i>
</el-upload>
js代码:
handleRemove(file, fileList) {
this.uploadDisabled = false;
this.fileList = fileList;
this.$emit("onChangImg", this.fileList);
this.$message.success("已移除");
},
handleCoverpicture(file) {
this.dialogVisibleAvatarImg = file.url;
this.dialogVisibleAvatar = true;
},
期望是点击编辑弹框默认是+号,而不是第一个图一样
盲猜 fileList 是有值的。
如果是组件更新问题,可以加
:key
强制更新