mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Reset value of interface interface when type gets changed (#4125)
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, PropType, inject, ref } from '@vue/composition-api';
|
||||
import { defineComponent, computed, PropType, inject, ref, watch } from '@vue/composition-api';
|
||||
import i18n from '@/lang';
|
||||
import { getInterfaces } from '@/interfaces';
|
||||
import { types } from '@/types';
|
||||
@@ -28,7 +28,7 @@ export default defineComponent({
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
setup(props, { emit }) {
|
||||
const interfaces = getInterfaces();
|
||||
|
||||
const values = inject('values', ref<Record<string, any>>({}));
|
||||
@@ -38,6 +38,13 @@ export default defineComponent({
|
||||
return values.value[props.typeField];
|
||||
});
|
||||
|
||||
watch(
|
||||
() => values.value[props.typeField],
|
||||
() => {
|
||||
emit('input', null);
|
||||
}
|
||||
);
|
||||
|
||||
const items = computed(() => {
|
||||
return interfaces.value
|
||||
.filter((inter) => inter.relational !== true && inter.system !== true)
|
||||
@@ -50,7 +57,7 @@ export default defineComponent({
|
||||
});
|
||||
});
|
||||
|
||||
return { items, selectedType };
|
||||
return { items, selectedType, values };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user