mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 11:07:52 +08:00
data-link 优化
This commit is contained in:
parent
7993bf61ff
commit
5441a4194c
@ -348,9 +348,13 @@ export default class Page extends React.Component<PageProps> {
|
||||
handleClick(e: any) {
|
||||
const target: HTMLElement = e.target as HTMLElement;
|
||||
const {env} = this.props;
|
||||
const link =
|
||||
target.tagName === 'A' && target.hasAttribute('data-link')
|
||||
? target.getAttribute('data-link')
|
||||
: target.closest('a[data-link]')?.getAttribute('data-link');
|
||||
|
||||
if (env && target.tagName === 'A' && target.hasAttribute('data-link')) {
|
||||
env.jumpTo(target.getAttribute('data-link') as string);
|
||||
if (env && link) {
|
||||
env.jumpTo(link);
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user