Files
simrsx-fe/app/components/pub/my-ui/combobox/index.ts

26 lines
535 B
TypeScript

export interface Item {
value: string
label: string
code?: string
priority?: number
}
export function recStrToItem(input: Record<string, string>): Item[] {
console.log(input)
const items: Item[] = []
let idx = 0;
for (const key in input) {
if (input.hasOwnProperty(key)) {
const value = input[key]
items.push({
value: key || ('unknown-' + idx),
label: input[key] || ('unknown-' + idx),
})
}
idx++
}
return items
}
export { default as Combobox } from './combobox.vue'