From 085ef85c6a41d3a28fd03a76d11c9f5bc4a55df0 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Thu, 9 Apr 2020 15:58:29 +0800 Subject: [PATCH] =?UTF-8?q?Nav=20=E6=94=AF=E6=8C=81=20onSelect=20=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Nav.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderers/Nav.tsx b/src/renderers/Nav.tsx index ab11f44b9..0a830d19d 100644 --- a/src/renderers/Nav.tsx +++ b/src/renderers/Nav.tsx @@ -34,6 +34,7 @@ export interface NavigationProps extends RendererProps { stacked?: boolean; links?: Links; source?: Api; + onSelect?: (item: Link) => any; } export default class Navigation extends React.Component< @@ -232,7 +233,11 @@ export default class Navigation extends React.Component< 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); }