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

feat: Tabs 在选中项更变后自动滚动定位至当前激活的 Tab #3685

Closed
wants to merge 6 commits into from
Closed

feat: Tabs 在选中项更变后自动滚动定位至当前激活的 Tab #3685

wants to merge 6 commits into from

Conversation

0xyk3r
Copy link

@0xyk3r 0xyk3r commented Sep 6, 2022

feat: Tabs 在选中项更变后自动滚动定位至当前激活的 Tab #3683

@vercel
Copy link

vercel bot commented Sep 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
naive-ui ❌ Failed (Inspect) Sep 6, 2022 at 2:18PM (UTC)

@JobinJia
Copy link

JobinJia commented Sep 6, 2022

刚好我也需要这个功能, 这里还有一个场景 初始化的时候就需要滚动一次位置(:value的初始值对应的位置) 是不是可以移一哈

onMounted(() => {
    watch(
        mergedValueRef,
        () => {
          const currentEl = getCurrentEl()
          const { value: xScrollInst } = xScrollInstRef
          if (!currentEl || !xScrollInst || !xScrollInst.$el) return
          xScrollInst.scrollTo({
            left:
              currentEl.clientWidth +
              currentEl.offsetLeft -
              xScrollInst.$el.offsetWidth / 2,
            top: 0,
            behavior: 'smooth'
          })
        },
        { flush: 'post', immediate: true },
    )
})

申明: 我不是该库的贡献者, 只是刚好有这个需求O O

update CHANGELOG.en-US.md
@07akioni
Copy link
Collaborator

如果没溢出的话还是不滚比较好

@07akioni
Copy link
Collaborator

处理了一下 536b755

@07akioni 07akioni closed this Sep 11, 2022
@u10k
Copy link

u10k commented Oct 22, 2022

为什么我觉得滚动到当前标签是正常的呢,不滚动反而很诡异

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

Successfully merging this pull request may close these issues.

5 participants