📌fix: QSelectBox 기본값 조건 변경
- 컴포넌트 하나로 여러 탭에서 새용시 기본값 보여주는 로직 수정
This commit is contained in:
parent
82bc00e2aa
commit
7e3ef71482
@ -32,20 +32,16 @@ export default function QSelectBox({
|
||||
* @returns {string} 초기 상태
|
||||
*/
|
||||
const handleInitState = () => {
|
||||
//title이 있으면 우선 보여준다(다른 키들 무시)
|
||||
if (title !== '') {
|
||||
return title
|
||||
}
|
||||
|
||||
//value가 없으면 showKey가 있으면 우선 보여준다
|
||||
if (showKey !== '' && !value) {
|
||||
//value가 없으면 showKey가 있으면 우선 보여준다
|
||||
return options[0][showKey]
|
||||
}
|
||||
|
||||
//value가 있으면 sourceKey와 targetKey를 비교하여 보여준다
|
||||
if (showKey !== '' && value) {
|
||||
} else if (showKey !== '' && value) {
|
||||
//value가 있으면 sourceKey와 targetKey를 비교하여 보여준다
|
||||
const option = options.find((option) => option[sourceKey] === value[targetKey])
|
||||
return option[showKey]
|
||||
} else {
|
||||
//일치하는 조건이 없으면 기본값을 보여준다.
|
||||
return title !== '' ? title : '선택하세요.'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user