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

[Table]通过stikcy实现锁列 #1728

Closed
youluna opened this issue Mar 31, 2020 · 0 comments
Closed

[Table]通过stikcy实现锁列 #1728

youluna opened this issue Mar 31, 2020 · 0 comments
Assignees

Comments

@youluna
Copy link
Member

youluna commented Mar 31, 2020

Component

Table

Feature Description

现有Table锁列方式是通过添加了额外的左锁列dom、右锁列dom,通过js同步滚动位置实现的,有一些列问题,可以考虑采用position: sticky的方式实现锁列功能。

对比

现有方式

  • 优点:
    各种浏览器下表现一致

  • 缺点:

  1. 性能损耗大,存在大量的滚动位置计算、被锁列的高度、宽度同步问题。
  2. 为支持合并单元格,有冗余计算逻辑
  3. 代码体积大,渲染到页面上存在冗余dom

sticky方式

  • 优点:
    完全不存在上述现有方式的缺点

  • 缺点:

  1. sticky不支持ie 11及以下,需要降级 caniuse
    image

方案

  • 方案一:
    通过sticky实现锁列功能,ie11降级为左右滚动,即ie浏览器下没有锁列功能。

  • 方案二:
    通过sticky实现锁列功能,ie11降级为现有方式实现,即ie浏览器用js计算同步的方式。

方案一和方案二差异在于是否要支持ie11的锁列,可以不支持ie11的话代码复杂度低,代码体积会大瘦身。

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

No branches or pull requests

1 participant