Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTabs在Tab过多的情况下自动滚动定位至当前激活的Tab #3683

Closed
0xyk3r opened this issue Sep 6, 2022 · 1 comment
Closed
Labels
feature request New feature or request

Comments

@0xyk3r
Copy link

0xyk3r commented Sep 6, 2022

This function solves the problem (这个功能解决的问题)

NTabs在Tab过多的情况下更新value,NTabs自动滚动定位至当前激活的Tab

Expected API (期望的 API)

NTabs在Tab过多的情况下更新value,NTabs自动滚动定位至当前激活的Tab

@github-actions github-actions bot added the feature request New feature or request label Sep 6, 2022
@0xyk3r
Copy link
Author

0xyk3r commented Sep 6, 2022

watch(mergedValueRef, () => {
tabChangeIdRef.id = 0
updateCurrentBarStyle()
})

我通过在之后追加如下代码实现了这个需求

watch(mergedValueRef, () => {
    void nextTick(() => {
        const tabEl = getCurrentEl()
        const { value: xScrollInst } = xScrollInstRef
        xScrollInst?.scrollTo({
            left: tabEl.offsetLeft,
            top: 0,
            behavior: 'smooth'
        })
    })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant