From e5742fc061685fcc9f933fb0501b1cb109e83d49 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Fri, 25 Mar 2022 21:55:32 +1100 Subject: Add tolNode parent pointers, tolMap, and layoutMap --- src/components/SearchModal.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/components/SearchModal.vue') diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue index 91e6748..35ea0ee 100644 --- a/src/components/SearchModal.vue +++ b/src/components/SearchModal.vue @@ -5,6 +5,7 @@ import {TolNode, LayoutNode} from '../lib'; export default defineComponent({ props: { layoutTree: {type: Object as PropType, required: true}, + tolMap: {type: Object as PropType>, required: true}, options: {type: Object, required: true}, }, methods: { @@ -14,7 +15,13 @@ export default defineComponent({ } }, onSearchEnter(){ - this.$emit('search-node', (this.$refs.searchInput as HTMLInputElement).value); + let searchString = (this.$refs.searchInput as HTMLInputElement).value; + let tolNode = this.tolMap.get(searchString); + if (tolNode == null){ + console.log('No result found'); + } else { + this.$emit('search-node', tolNode); + } }, }, mounted(){ -- cgit v1.2.3