类型是这样的
export type IMenuItem = {
title : string,
data : IMenuSubItem[],
iconSize ?: string,
badge ?: number[],
click ?: (item : IMenuSubItem, index : number) => void,
hide ?: () => boolean,
}
调用后报错
18:15:09.815 error: Reference has a nullable type '(() -> Boolean)?', use explicit '?.invoke()' to make a function-like call instead
18:15:09.815 at pages/tabbar/my.uvue:223:31
18:15:09.815 221| const menuList = computed(() => {
18:15:09.815 222| return MENU_LIST.filter((v) => {
18:15:09.815 223| return v?.hide == null || v.hide() == false;
18:15:09.816 | ^
18:15:09.816 224| });
18:15:09.816 225| });
1 个回复
kaleidosJohna (作者)
已解决