mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
chore: 锚点导航标识调整为data-id (#11144)
This commit is contained in:
parent
42f2b5bdac
commit
e53d6d0d0c
@ -32,7 +32,7 @@ class AnchorNavSectionComponent extends React.PureComponent<AnchorNavSectionProp
|
||||
<div
|
||||
ref={this.contentRef}
|
||||
className={cx('AnchorNav-section', className)}
|
||||
id={name + ''}
|
||||
data-id={name + ''}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
@ -98,7 +98,7 @@ export class AnchorNav extends React.Component<AnchorNavProps> {
|
||||
@autobind
|
||||
scrollToNav(entries: IntersectionObserverEntry[]) {
|
||||
entries.forEach(entry => {
|
||||
const key = entry.target.id;
|
||||
const key = entry.target.getAttribute('data-id');
|
||||
const currentSection = this.sections.find(item => item.key === key);
|
||||
if (currentSection) {
|
||||
currentSection.isIntersecting = entry.isIntersecting;
|
||||
|
@ -55,7 +55,7 @@ exports[`Renderer:anchorNav 1`] = `
|
||||
>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="0"
|
||||
data-id="0"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -180,7 +180,7 @@ exports[`Renderer:anchorNav 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="1"
|
||||
data-id="1"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -305,7 +305,7 @@ exports[`Renderer:anchorNav 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="2"
|
||||
data-id="2"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -645,7 +645,7 @@ exports[`Renderer:anchorNav with children 1`] = `
|
||||
>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="0"
|
||||
data-id="0"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -770,7 +770,7 @@ exports[`Renderer:anchorNav with children 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="0-0"
|
||||
data-id="0-0"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -895,7 +895,7 @@ exports[`Renderer:anchorNav with children 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="0-1"
|
||||
data-id="0-1"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -1020,7 +1020,7 @@ exports[`Renderer:anchorNav with children 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="1"
|
||||
data-id="1"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
@ -1189,7 +1189,7 @@ exports[`Renderer:anchorNav with horizontal 1`] = `
|
||||
>
|
||||
<div
|
||||
class="cxd-AnchorNav-section"
|
||||
id="0"
|
||||
data-id="0"
|
||||
>
|
||||
<div
|
||||
class="cxd-Panel cxd-Panel--default cxd-Panel--form"
|
||||
|
Loading…
Reference in New Issue
Block a user