|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="menu-container">
|
|
|
- <div class="search-box">
|
|
|
+ <div ref="searchBoxRef" class="search-box">
|
|
|
<input v-model="searchState.searchText" class="input" @keyup.enter="changeSearchText" />
|
|
|
<div v-show="searchState.showList" class="search-content">
|
|
|
<div class="search-title">全局搜索</div>
|
|
@@ -138,6 +138,7 @@
|
|
|
import { getPointInfoComprehensiveSearch } from '@/api/globalMap';
|
|
|
import { listMenu2 } from '@/api/system/menu';
|
|
|
import { deepClone } from '@/utils';
|
|
|
+import { onClickOutside } from '@vueuse/core';
|
|
|
|
|
|
const emits = defineEmits(['switchMap', 'clickMenu', 'selectSearchMarker']);
|
|
|
const getPlaceSearch = inject('getPlaceSearch');
|
|
@@ -153,6 +154,10 @@ const searchState = reactive({
|
|
|
});
|
|
|
let showDialog = ref(false);
|
|
|
let videoMonitorData = ref({});
|
|
|
+let searchBoxRef = ref();
|
|
|
+onClickOutside(searchBoxRef, (event) => {
|
|
|
+ searchState.showList = false;
|
|
|
+});
|
|
|
const changeSearchText = () => {
|
|
|
if (!searchState.searchText) {
|
|
|
searchState.showList = false;
|
|
@@ -179,7 +184,6 @@ const changeSearchText = () => {
|
|
|
latitude: item.location.lat
|
|
|
};
|
|
|
});
|
|
|
- debugger
|
|
|
searchState.resultList = arr;
|
|
|
}
|
|
|
});
|