mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-21 03:19:19 +08:00
perf: 对搜索菜单组件进行优化 (#106)
This commit is contained in:
parent
f12f33014e
commit
5f0e91c5ec
@ -7,9 +7,7 @@ interface Props {
|
||||
total: number
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
total: 0
|
||||
})
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const appStore = useAppStore()
|
||||
const isMobile = computed(() => appStore.device === DeviceEnum.Mobile)
|
||||
|
@ -5,7 +5,7 @@ import { useAppStore } from "@/store/modules/app"
|
||||
import { usePermissionStore } from "@/store/modules/permission"
|
||||
import SearchResult from "./SearchResult.vue"
|
||||
import SearchFooter from "./SearchFooter.vue"
|
||||
import { ElScrollbar } from "element-plus"
|
||||
import { ElMessage, ElScrollbar } from "element-plus"
|
||||
import { cloneDeep, debounce } from "lodash-es"
|
||||
import { DeviceEnum } from "@/constants/app-key"
|
||||
|
||||
@ -119,7 +119,11 @@ const handleDown = () => {
|
||||
/** 键盘回车键 */
|
||||
const handleEnter = () => {
|
||||
const { length } = resultList.value
|
||||
if (length === 0 || !activeRouteName.value) return
|
||||
if (length === 0) return
|
||||
if (!activeRouteName.value) {
|
||||
ElMessage.error("无法通过搜索功能进入该菜单,请为对应的路由设置唯一的 Name")
|
||||
return
|
||||
}
|
||||
router.push({ name: activeRouteName.value })
|
||||
handleClose()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user