diff --git a/components/menu/index.tsx b/components/menu/index.tsx index 3d85e561ca..7d7033a96c 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -77,7 +77,7 @@ export default class Menu extends React.Component { let firstValue = ''; if (value && value.length) { // if has init path, chose init first value firstValue = value[0] as string; // this is a contract - } else if (data && !data[0].isLeaf) { // chose the first menu item if it's not leaf. + } else if (data && data.length && !data[0].isLeaf) { // chose the first menu item if it's not leaf. firstValue = data[0].value; }