Skip to content

Commit

Permalink
Merge pull request #342 from kaola-fed/KLUpload_add_class_20180410
Browse files Browse the repository at this point in the history
KLUpload组件通过名称确定类型不区分大小写,fileList添加class参数配置
  • Loading branch information
nupthale authored Apr 10, 2018
2 parents 7922a18 + 108bb8f commit 1abedac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="m-file-unit">
<div class="m-file-unit {file.class}">
<div class="m-content">
{#if type === 'image'}
<div class="m-img-wrapper" on-click={this.onPreview($event)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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];
}
});
Expand Down
5 changes: 3 additions & 2 deletions src/js/components/form/KLUpload/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 1abedac

Please sign in to comment.