uploadImgData: { busiName: 32 },
// 应付多个组件的情况 记录当前组件的key值
componentKey: null,
};
},
methods: {
uploadImg() {},
handleAvatarSuccess(res, file) {
// console.log(res)
this.imageUrl = res.data.url;
this.$emit(“childRightFn”, {
…this.rightData,
…{ imageUrl: this.imageUrl},
…{props: {src: this.imageUrl}}
});
},
beforeAvatarUpload(file) {
const isJPG =
file.type === “image/jpeg” ||
file.type === “image/jpg” ||
file.type === “image/png”;
// 限制只能3M以内的图片
const isLt2M = file.size / 1024 / 1024 < 3;
if (!isJPG) {
this.$message.error(“图片只能是 JPG 或者 PNG 格式!”);
}
if (!isLt2M) {
this.$message.error(“上传头像图片大小不能超过 3MB!”);
}
return isJPG && isLt2M;
},
},
- 请大家按需取用,不需要删掉就是,不要原封不动的搬