-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
陌缓
committed
Jul 8, 2022
1 parent
60531f9
commit 7eb133d
Showing
6 changed files
with
70 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": {} | ||
"usingComponents": { | ||
"tap-modal":"../TapModal/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
function getFixedValue (value, multiple) { | ||
let fixedValue; | ||
if (multiple) { | ||
fixedValue = value; | ||
} | ||
else { | ||
fixedValue = value && value.slice(0, 1) | ||
const getFixedValue = (value, multiple) => { | ||
let fixedValue = []; | ||
if (value === null) { | ||
fixedValue = [] | ||
} else if (multiple && value.constructor === 'Array') { | ||
fixedValue = value | ||
} else if (!(value.constructor === 'Array')) { | ||
fixedValue = [value] | ||
} | ||
return fixedValue; | ||
}; | ||
|
||
if (fixedValue) { | ||
return fixedValue; | ||
} | ||
// 如果不是数组, 返回数组兜底 | ||
return [] | ||
} | ||
const getIsCurItemSelected = (value, multiple, itemValue) => { | ||
const fixedValue = getFixedValue(value, multiple); | ||
|
||
function getIsCurItemSelected(value, multiple, itemValue) { | ||
const fixedValue = getFixedValue(value, multiple) | ||
return fixedValue.indexOf(itemValue) !== -1 | ||
return fixedValue.indexOf(itemValue) !== -1; | ||
} | ||
|
||
function getSelectedClassName(activeItemClassName) { | ||
return 'amd-selector-item-active ' + activeItemClassName | ||
} | ||
|
||
export default { | ||
getIsCurItemSelected, | ||
getSelectedClassName | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters