Commit b5f24880 authored by leiqingsong's avatar leiqingsong

上传头像大小限制

parent b595199c
......@@ -7,6 +7,8 @@
:max-count="1"
:before-delete="onDeleteAvatar"
:after-read="onRead"
:max-size="2 * 1024 * 1024"
@oversize="onOversize"
>
<van-button type="primary">上传新头像</van-button>
</van-uploader>
......@@ -59,6 +61,9 @@ export default {
}
});
},
onOversize() {
this.$toast.fail("上传头像超过了2M的限制,请重新上传");
},
onRead(file) {
console.log("读取到图片了", file);
const inviteCode = JSON.parse(localStorage.getItem("user")).inviteCode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment