Skip to content

Commit

Permalink
Merge pull request #338 from kaola-fed/bugfix_klselect_isCaseSensitive
Browse files Browse the repository at this point in the history
KLSelect的isCaseSensitive属性值意思写反了,默认改为不区分大小写
  • Loading branch information
nupthale authored Apr 11, 2018
2 parents 1abedac + a0e6c23 commit 5e28247
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/js/components/form/KLSelect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const KLSelect = Dropdown.extend({
canSearch: undefined,
filter: null,
// 默认不区分大小写
isCaseSensitive: true,
isCaseSensitive: false,
noMatchText: this.$trans('NO_MATCH'),
delaySearch: 300,
maxShowCount: 1000,
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/form/KLSelect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ var component = new NEKUI.Component({
value: '',
limit: null,
source: [
{name: '母婴儿童123'},{name: '母婴儿童12'},
{name: '母婴儿童1'},{name: '母婴儿童'},
{name: '母婴儿童Dr.CI'},{name: '母婴儿童Filorga'},
{name: '母婴儿童age20'},{name: '母婴儿童'},
{name: '营养保健'},{name: '海外直邮'},
{name: '数码家电'},{name: '环球美食'},
{name: '运动户外'},{name: '水果生鲜'},
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/form/KLSelect/plugins/private.method.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ module.exports = function PrivateMethod(Component) {
let searchValue = (data.searchValue || '').trim();
const maxShowCount = data.maxShowCount;
const isCaseSensitive = data.isCaseSensitive;
searchValue = isCaseSensitive ? searchValue.toLowerCase() : searchValue;
searchValue = isCaseSensitive ? searchValue : searchValue.toLowerCase();
let targetSource = source.filter((item, index) => {
const text = `${item[nameKey]}`;
const value = isCaseSensitive ? text.toLowerCase() : text;
const value = isCaseSensitive ? text : text.toLowerCase();
return (
(searchValue && value.indexOf(searchValue) >= 0) ||
(!searchValue && index < maxShowCount)
Expand Down

0 comments on commit 5e28247

Please sign in to comment.