var selectedImg = e.target.files[0]; //获取图片
				var isPic = /^(image\/bmp|image\/gif|image\/jpeg|image\/png|image\/tiff)$/i; //验证正则
				if(selectedImg) {
					if(!isPic.test(selectedImg.type)) {
						alert('文件格式必须为图片');
						return;
					}
					if(selectedImg.size > 2097152) {
						alert("图片大小不能超过2M");
						return;
					}
					this.images = URL.createObjectURL(selectedImg); //化为可浏览地址
				}

  

相关文章:

  • 2022-12-23
  • 2021-09-12
  • 2021-07-04
猜你喜欢
  • 2021-07-10
  • 2021-12-08
  • 2021-05-27
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案