Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议upload组件加入上传图片大小限制 #39

Open
ChartWay opened this issue Jul 4, 2020 · 0 comments
Open

建议upload组件加入上传图片大小限制 #39

ChartWay opened this issue Jul 4, 2020 · 0 comments

Comments

@ChartWay
Copy link

ChartWay commented Jul 4, 2020

image
现在的upload上传大图片出现报错,建议加上上传大小限制:
`beforeImageUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;

  if (!isJPG) {
    this.$message.error('上传头像图片只能是 JPG 格式!');
  }
  if (!isLt2M) {
    this.$message.error('上传头像图片大小不能超过 2MB!');
  }
  return isJPG && isLt2M;
},`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant