-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 更改input值的显示逻辑;更改options的显示逻辑;增加缓存options的功能;增加多选选项但功能未完成
- Loading branch information
Showing
7 changed files
with
108 additions
and
40 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ComputedRef, computed } from 'vue'; | ||
import { OptionObjectItem } from '../src/use-select'; | ||
import { KeyType } from '../src/utils'; | ||
|
||
export default function (mergeOptions: ComputedRef<OptionObjectItem[]>): any { | ||
const cacheOptions = computed(() => { | ||
const map = new Map<KeyType<OptionObjectItem, 'value'>, OptionObjectItem>(); | ||
mergeOptions.value.forEach((item) => { | ||
map.set(item.value, item); | ||
}); | ||
return map; | ||
}); | ||
|
||
const getValuesOption = (values: KeyType<OptionObjectItem, 'value'>[]) => | ||
values.map((value) => cacheOptions.value.get(value)); | ||
|
||
return getValuesOption; | ||
} |
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
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 |
---|---|---|
|
@@ -17,3 +17,5 @@ export function className( | |
|
||
return classname; | ||
} | ||
|
||
export type KeyType<T, K extends keyof T> = T[K] |