generated from Seekra/repository-template
fix(settings): make selection reactive
Selection now uses computed with getter and setter.
This commit is contained in:
@@ -54,10 +54,9 @@ const props = defineProps({
|
|||||||
const store = useSettingsStore();
|
const store = useSettingsStore();
|
||||||
|
|
||||||
const optionType = computed(() => props.setting.allowMultiple ? 'checkbox' : 'radio');
|
const optionType = computed(() => props.setting.allowMultiple ? 'checkbox' : 'radio');
|
||||||
const selected = ref(normalizeSelectedValue(store.get(props.path) ?? props.setting.default));
|
const selected = computed({
|
||||||
|
get: () => normalizeSelectedValue(store.get(props.path) ?? props.setting.default),
|
||||||
watch(selected, (newValue) => {
|
set: (value) => store.set(props.path, value)
|
||||||
store.set(props.path, newValue);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const labelId = useId();
|
const labelId = useId();
|
||||||
|
|||||||
Reference in New Issue
Block a user