fix: eventConfig为空导致显示异常

This commit is contained in:
yangmi 2022-07-22 15:37:10 +08:00
parent 9a42915244
commit a4bd736a8c
2 changed files with 4 additions and 2 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@ dist
dist-ssr dist-ssr
*.local *.local
.vscode .vscode
./stats.html stats.html

View File

@ -17,6 +17,7 @@ import { getSizeStyle } from '../../utils'
import { EventTriggerType } from '@/enums/eventEnum' import { EventTriggerType } from '@/enums/eventEnum'
import { CreateComponentType, EventConfig } from '@/packages/index.d' import { CreateComponentType, EventConfig } from '@/packages/index.d'
import { newFunctionHandle } from '@/utils' import { newFunctionHandle } from '@/utils'
import isObject from 'lodash/isObject'
const props = defineProps({ const props = defineProps({
item: { item: {
@ -49,7 +50,8 @@ const bus = useEventBus()
* } * }
*/ */
const getEventList = (eventConfig: EventConfig) => { const getEventList = (eventConfig: EventConfig) => {
const res = Object.keys(eventConfig) // other if(!isObject(eventConfig)) return {}
const res = Object.keys(eventConfig)
.reduce((previousValue: EventConfig, currentValue: string) => { .reduce((previousValue: EventConfig, currentValue: string) => {
// @ts-ignore // @ts-ignore
previousValue[currentValue] = eventConfig[currentValue].methodList.map((item: any) => { previousValue[currentValue] = eventConfig[currentValue].methodList.map((item: any) => {