Use type instead of isAccount flag
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -6,23 +6,26 @@ import { useBudgetsStore } from "../stores/budget";
|
||||
export interface Suggestion {
|
||||
ID: string
|
||||
Name: string
|
||||
Type: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
text: String,
|
||||
id: String | undefined,
|
||||
model: String
|
||||
model: String,
|
||||
type?: string | undefined,
|
||||
}>();
|
||||
|
||||
const SearchQuery = ref(props.text || "");
|
||||
const Suggestions = ref<Array<Suggestion>>([]);
|
||||
const emit = defineEmits(["update:id", "update:text"]);
|
||||
const emit = defineEmits(["update:id", "update:text", "update:type"]);
|
||||
watch(SearchQuery, () => {
|
||||
load(SearchQuery.value);
|
||||
});
|
||||
function load(text: String) {
|
||||
emit('update:id', null);
|
||||
emit('update:text', text);
|
||||
emit('update:type', undefined);
|
||||
if (text == "") {
|
||||
Suggestions.value = [];
|
||||
return;
|
||||
@@ -53,6 +56,7 @@ function keypress(e: KeyboardEvent) {
|
||||
function selectElement(element: Suggestion) {
|
||||
emit('update:id', element.ID);
|
||||
emit('update:text', element.Name);
|
||||
emit('update:type', element.Type);
|
||||
Suggestions.value = [];
|
||||
};
|
||||
function select(e: MouseEvent) {
|
||||
@@ -67,6 +71,7 @@ function select(e: MouseEvent) {
|
||||
function clear() {
|
||||
emit('update:id', null);
|
||||
emit('update:text', SearchQuery.value);
|
||||
emit('update:type', undefined);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user