fix(Kbd): optional value prop when using default slot

This commit is contained in:
Benjamin Canac
2024-07-10 18:43:30 +02:00
parent bc633c6687
commit 40d17f7b03
2 changed files with 5 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ export interface KbdProps {
* @defaultValue 'kbd'
*/
as?: any
value: KbdKey | string
value?: KbdKey | string
variant?: KbdVariants['variant']
size?: KbdVariants['size']
class?: any

View File

@@ -35,7 +35,10 @@ const _useKbd = () => {
metaSymbol.value = macOS.value ? kbdKeysMap.command : kbdKeysMap.ctrl
})
function getKbdKey(value: KbdKey | string) {
function getKbdKey(value?: KbdKey | string) {
if (!value) {
return
}
if (value === 'meta') {
return metaSymbol.value
}