diff --git a/frontend/src/components/Controls/Link.vue b/frontend/src/components/Controls/Link.vue index 3e2738bf..1588df1a 100644 --- a/frontend/src/components/Controls/Link.vue +++ b/frontend/src/components/Controls/Link.vue @@ -4,6 +4,7 @@ {{ attrs.label }} import { call } from 'frappe-ui' import Autocomplete from '@/components/frappe-ui/Autocomplete.vue' -import { useAttrs, computed } from 'vue' +import { useAttrs, computed, ref } from 'vue' import { computedAsync } from '@vueuse/core' const props = defineProps({ @@ -39,9 +40,12 @@ const value = computed({ set: (val) => emit('update:modelValue', val?.value), }) +const autocomplete = ref(null) +const text = computed(() => autocomplete.value?.query) + const options = computedAsync(async () => { let options = await call('frappe.desk.search.search_link', { - txt: '', + txt: text.value || '', doctype: props.doctype, }) return options?.map((option) => { diff --git a/frontend/src/components/frappe-ui/Autocomplete.vue b/frontend/src/components/frappe-ui/Autocomplete.vue index ed581bb2..9e641b9a 100644 --- a/frontend/src/components/frappe-ui/Autocomplete.vue +++ b/frontend/src/components/frappe-ui/Autocomplete.vue @@ -248,4 +248,6 @@ const inputClasses = computed(() => { 'transition-colors w-full', ] }) + +defineExpose({ query })