From 96d4a490c96d639e216adcce30983bb4031b1b58 Mon Sep 17 00:00:00 2001 From: Rabbit_PL Date: Tue, 10 Apr 2018 19:34:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(KLUpload):=20klupload=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=80=9A=E8=BF=87=E5=90=8D=E7=A7=B0=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8D=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=86=99=EF=BC=8C=E6=B7=BB=E5=8A=A0class=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/form/KLUpload/components/FileUnit/index.html | 2 +- .../components/form/KLUpload/components/UploadBase/index.js | 4 +++- src/js/components/form/KLUpload/index.md | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/js/components/form/KLUpload/components/FileUnit/index.html b/src/js/components/form/KLUpload/components/FileUnit/index.html index f7d584ab..2fd1c52f 100644 --- a/src/js/components/form/KLUpload/components/FileUnit/index.html +++ b/src/js/components/form/KLUpload/components/FileUnit/index.html @@ -1,4 +1,4 @@ -
+
{#if type === 'image'}
diff --git a/src/js/components/form/KLUpload/components/UploadBase/index.js b/src/js/components/form/KLUpload/components/UploadBase/index.js index 0f54bea7..9883a4ce 100644 --- a/src/js/components/form/KLUpload/components/UploadBase/index.js +++ b/src/js/components/form/KLUpload/components/UploadBase/index.js @@ -174,6 +174,7 @@ const UploadBase = Component.extend({ flag: file.flag, uid: file.uid, status: 'success', + class: file.class, }; if (fileunit.flag !== Config.flagMap.DELETED) { @@ -560,7 +561,8 @@ const UploadBase = Component.extend({ Object.keys(typeMap).forEach((key) => { const reg = new RegExp(`${key}$`); - if (reg.test(type) || (!type && reg.test(name))) { + // 名称后缀不区分大小写 + if (reg.test(type) || (!type && reg.test(name.toLowerCase()))) { typeStr = typeMap[key]; } }); diff --git a/src/js/components/form/KLUpload/index.md b/src/js/components/form/KLUpload/index.md index 893a7055..63845dc7 100644 --- a/src/js/components/form/KLUpload/index.md +++ b/src/js/components/form/KLUpload/index.md @@ -146,8 +146,9 @@ var component = new NEKUI.Component({ template: template, data: { list: [{ - name: 'Game.jpg', - url: 'http://haitao.nos.netease.com/906f417c7c964c0798adf9d0bf1b5c8c.jpg' + name: 'Game.JPG', + url: 'http://haitao.nos.netease.com/906f417c7c964c0798adf9d0bf1b5c8c.jpg', + class: 'my-img-test' }, { name: 'Kaola.jpg', url: 'http://haitao.nos.netease.com/9b73692b3a6b46d2be1de7d3be893834.jpg' From 2cbbc127daca004697d2032b0afd1d532e5dbc53 Mon Sep 17 00:00:00 2001 From: Rabbit_PL Date: Tue, 10 Apr 2018 21:08:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(KLUpload):=20=E5=88=A4=E7=A9=BA?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/form/KLUpload/components/UploadBase/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/components/form/KLUpload/components/UploadBase/index.js b/src/js/components/form/KLUpload/components/UploadBase/index.js index 9883a4ce..09b0a686 100644 --- a/src/js/components/form/KLUpload/components/UploadBase/index.js +++ b/src/js/components/form/KLUpload/components/UploadBase/index.js @@ -174,7 +174,7 @@ const UploadBase = Component.extend({ flag: file.flag, uid: file.uid, status: 'success', - class: file.class, + class: file.class || '', }; if (fileunit.flag !== Config.flagMap.DELETED) { @@ -562,7 +562,7 @@ const UploadBase = Component.extend({ Object.keys(typeMap).forEach((key) => { const reg = new RegExp(`${key}$`); // 名称后缀不区分大小写 - if (reg.test(type) || (!type && reg.test(name.toLowerCase()))) { + if (reg.test(type) || (!type && reg.test(`${name}`.toLowerCase()))) { typeStr = typeMap[key]; } });