feat: show option propertie (service)

This commit is contained in:
puriphatt 2024-06-24 11:10:28 +00:00
parent 9ce656ae45
commit c240963512
5 changed files with 158 additions and 107 deletions

View file

@ -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,
};
});