mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-06 05:58:25 +08:00
Nav 支持 onSelect 事件
This commit is contained in:
parent
5557c4e226
commit
085ef85c6a
@ -34,6 +34,7 @@ export interface NavigationProps extends RendererProps {
|
|||||||
stacked?: boolean;
|
stacked?: boolean;
|
||||||
links?: Links;
|
links?: Links;
|
||||||
source?: Api;
|
source?: Api;
|
||||||
|
onSelect?: (item: Link) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Navigation extends React.Component<
|
export default class Navigation extends React.Component<
|
||||||
@ -232,7 +233,11 @@ export default class Navigation extends React.Component<
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {env, data} = this.props;
|
const {env, data, onSelect} = this.props;
|
||||||
|
|
||||||
|
if (onSelect && onSelect(link) === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
env && env.jumpTo(filter(link.to as string, data), link as any);
|
env && env.jumpTo(filter(link.to as string, data), link as any);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user