Skip to content

Commit

Permalink
fix(Menu): while props.data is [], data[0] get error (#2079)
Browse files Browse the repository at this point in the history
fix(Menu): while props.data is [], data[0] get error
  • Loading branch information
fancymo authored and silentcloud committed Nov 16, 2017
1 parent 3f1d7db commit 15b2521
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class Menu extends React.Component<MenuProps, StateType> {
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;
}

Expand Down

0 comments on commit 15b2521

Please sign in to comment.