fix(components): [menu] Avoid call router when index is not provided (#12206)

closed #9945
This commit is contained in:
Hefty
2023-04-06 18:01:45 +08:00
committed by GitHub
parent 266d9d7a2f
commit fc3be9dbdb

View File

@@ -12,6 +12,7 @@ import {
watchEffect,
} from 'vue'
import { useResizeObserver } from '@vueuse/core'
import { isNil } from 'lodash-unified'
import ElIcon from '@element-plus/components/icon'
import { More } from '@element-plus/icons-vue'
import {
@@ -191,7 +192,7 @@ export default defineComponent({
}
const { index, indexPath } = menuItem
if (index === undefined || indexPath === undefined) return
if (isNil(index) || isNil(indexPath)) return
if (props.router && router) {
const route = menuItem.route || index