feat: show option propertie (service)
This commit is contained in:
parent
9ce656ae45
commit
c240963512
5 changed files with 158 additions and 107 deletions
|
|
@ -4,8 +4,21 @@ import { defineStore } from 'pinia';
|
|||
const useOptionStore = defineStore('optionStore', () => {
|
||||
const globalOption = ref();
|
||||
|
||||
function mapOption(value: string) {
|
||||
for (const category in globalOption.value) {
|
||||
if (globalOption.value.hasOwnProperty(category)) {
|
||||
const option = globalOption.value[category].find(
|
||||
(opt: { value: string }) => opt.value === value,
|
||||
);
|
||||
if (option) return option.label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
globalOption,
|
||||
|
||||
mapOption,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue