chore(Accordion): type for items

Resolves #412
This commit is contained in:
Benjamin Canac
2023-07-17 11:25:59 +02:00
parent 908235e8dd
commit 2ec28e7cbd
2 changed files with 11 additions and 2 deletions

View File

@@ -48,7 +48,7 @@ import { omit } from 'lodash-es'
import UIcon from '../elements/Icon.vue' import UIcon from '../elements/Icon.vue'
import UButton from '../elements/Button.vue' import UButton from '../elements/Button.vue'
import StateEmitter from '../../utils/StateEmitter' import StateEmitter from '../../utils/StateEmitter'
import type { Button } from '../../types/button' import type { AccordionItem } from '../../types/accordion'
import { useAppConfig } from '#imports' import { useAppConfig } from '#imports'
// TODO: Remove // TODO: Remove
// @ts-expect-error // @ts-expect-error
@@ -66,7 +66,7 @@ export default defineComponent({
inheritAttrs: false, inheritAttrs: false,
props: { props: {
items: { items: {
type: Array as PropType<Partial<Button & { slot: string, disabled: boolean, content: string, defaultOpen: boolean, closeOthers: boolean }>[]>, type: Array as PropType<AccordionItem[]>,
default: () => [] default: () => []
}, },
defaultOpen: { defaultOpen: {

9
src/runtime/types/accordion.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { Button } from './button'
export interface AccordionItem extends Partial<Button> {
slot?: string
disabled?: boolean
content?: string
defaultOpen?: boolean
closeOthers?: boolean
}