提交 610aa59c 编写于 作者: haochangdi's avatar haochangdi

修改上传图片大小的提示

上级 8f4470bd
...@@ -450,10 +450,6 @@ export default { ...@@ -450,10 +450,6 @@ export default {
const isJPG = file.type === "image/jpeg"; const isJPG = file.type === "image/jpeg";
const isPNG = file.type === "image/png"; const isPNG = file.type === "image/png";
const isLt2M = file.size / 1024 / 1024 < fileLimit.size; const isLt2M = file.size / 1024 / 1024 < fileLimit.size;
if (file.width != fileLimit.width || file.height != fileLimit.height) {
vm.$message.error("图片不符合规范,请根据规范上传图片");
return;
}
if (!isJPG && !isPNG) { if (!isJPG && !isPNG) {
vm.$message.error("图片不符合规范,请根据规范上传图片"); vm.$message.error("图片不符合规范,请根据规范上传图片");
return; return;
...@@ -468,10 +464,10 @@ export default { ...@@ -468,10 +464,10 @@ export default {
let image = new Image(); let image = new Image();
image.src = theFile.target.result; image.src = theFile.target.result;
image.onload = function() { image.onload = function() {
let _vm = vm; let _vm = this;
if ( false if (
// _vm.width != fileLimit.width || _vm.width != fileLimit.width ||
// _vm.height != fileLimit.height _vm.height != fileLimit.height
) { ) {
vm.$message.error("图片不符合规范,请根据规范上传图片"); vm.$message.error("图片不符合规范,请根据规范上传图片");
} else { } else {
......
...@@ -463,10 +463,6 @@ export default { ...@@ -463,10 +463,6 @@ export default {
const isJPG = file.type === "image/jpeg"; const isJPG = file.type === "image/jpeg";
const isPNG = file.type === "image/png"; const isPNG = file.type === "image/png";
const isLt2M = file.size / 1024 / 1024 < fileLimit.size; const isLt2M = file.size / 1024 / 1024 < fileLimit.size;
if (file.width != fileLimit.width || file.height != fileLimit.height) {
vm.$message.error("图片不符合规范,请根据规范上传图片");
return;
}
if (!isJPG && !isPNG) { if (!isJPG && !isPNG) {
vm.$message.error("图片不符合规范,请根据规范上传图片"); vm.$message.error("图片不符合规范,请根据规范上传图片");
return; return;
...@@ -481,10 +477,10 @@ export default { ...@@ -481,10 +477,10 @@ export default {
let image = new Image(); let image = new Image();
image.src = theFile.target.result; image.src = theFile.target.result;
image.onload = function() { image.onload = function() {
let _vm = vm; let _vm = this;
if ( false if (
// _vm.width != fileLimit.width || _vm.width != fileLimit.width ||
// _vm.height != fileLimit.height _vm.height != fileLimit.height
) { ) {
vm.$message.error("图片不符合规范,请根据规范上传图片"); vm.$message.error("图片不符合规范,请根据规范上传图片");
} else { } else {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册