diff --git a/src/interface.vue b/src/interface.vue index e173b659..5a330f60 100644 --- a/src/interface.vue +++ b/src/interface.vue @@ -11,7 +11,7 @@ :collection="collection" :primary-key="primaryKey" :model-value="value" - @update:model-value="$emit('input', $event)" + @update:model-value="onInput" /> {{ errorMsg }} @@ -83,6 +83,7 @@ export default defineComponent({ const computedValue = ref(props.value); const relations = useCollectionRelations(props.collection); const { collection, field, primaryKey } = toRefs(props) + const isComputedEditing = ref(true); const values = useDeepValues( inject>>('values')!, @@ -96,6 +97,11 @@ export default defineComponent({ if (values) { watch(values, () => { + if (isComputedEditing.value) { + isComputedEditing.value = false + return + } + const newValue = compute(); computedValue.value = newValue; @@ -116,6 +122,7 @@ export default defineComponent({ return { computedValue, errorMsg, + onInput, }; function compute() { @@ -139,6 +146,11 @@ export default defineComponent({ return null; } } + + function onInput(value: string) { + isComputedEditing.value = true; + emit('input', value); + } }, });