Skip to content

Anchor的getCurrentAnchor属性提供默认link参数 #34784

@helianthuswhite

Description

@helianthuswhite

What problem does this feature solve?

在Anchor的高亮处理时,需要根据条件判断是否固定显示某一个高亮,如果不满足条件则继续使用默认的高亮。

What does the proposed API look like?

getCurrentAnchor?: (link: string) => string;

用法例如下面:

<Anchor
    affix={false}
    onClick={handleClick}
    getCurrentAnchor={link => {
        if (activeTab && activeTab.tabType === TabType.tab) {
            return `#mid_${activeTab?.entityType}_${activeTab?.tabId}`;
        }
        return link;
    }}
    getContainer={() => document.querySelector(".content") as HTMLDivElement}
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions