Fix nested system-interface-options usage (#9483)

* Improve null check in list

* Fix options syncing in system-interface-options
This commit is contained in:
Rijk van Zanten
2021-11-04 14:12:37 -04:00
committed by GitHub
parent 9c48eed176
commit 71ec7115c0
2 changed files with 12 additions and 3 deletions

View File

@@ -52,11 +52,20 @@ export default defineComponent({
},
},
emits: ['input'],
setup(props) {
setup(props, { emit }) {
const { t } = useI18n();
const { interfaces } = getInterfaces();
const options = computed({
get() {
return props.value;
},
set(newVal: any) {
emit('input', newVal);
},
});
const values = inject('values', ref<Record<string, any>>({}));
const selectedInterface = computed(() => {
@@ -120,7 +129,7 @@ export default defineComponent({
return [...optionsObjectOrArray.standard, ...optionsObjectOrArray.advanced];
});
return { t, selectedInterface, values, usesCustomComponent, optionsFields };
return { t, selectedInterface, values, usesCustomComponent, optionsFields, options };
},
});
</script>

View File

@@ -269,7 +269,7 @@ export default defineComponent({
}
function emitValue(value: null | any[]) {
if (value === null || value.length === 0) {
if (!value || value.length === 0) {
return emit('input', null);
}