feat(Tab): improve scrollLeftTo performance

This commit is contained in:
陈嘉涵
2019-12-16 20:57:13 +08:00
parent e9369acf26
commit f8a3669f2d
5 changed files with 35 additions and 28 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ In scrollspy mode, the list of content will be tiled
| sticky | Whether to use sticky mode | *boolean* | `false` | - |
| swipeable | Whether to switch tabs with swipe gestrue in the content | *boolean* | `false` | - |
| lazy-render | Whether to enable tab content lazy render | *boolean* | `true` | - |
| scrollspy | Whether to use scrollspy mode | *boolean* | `false` | - |
| scrollspy | Whether to use scrollspy mode | *boolean* | `false` | 2.3.0 |
### Tab Props
+1 -1
View File
@@ -209,7 +209,7 @@ export default {
| sticky | 是否使用粘性定位布局 | *boolean* | `false` | - |
| swipeable | 是否开启手势滑动切换 | *boolean* | `false` | - |
| lazy-render | 是否开启标签页内容延迟渲染 | *boolean* | `true` | - |
| scrollspy | 是否开启滚动导航 | *boolean* | `false` | - |
| scrollspy | 是否开启滚动导航 | *boolean* | `false` | 2.3.0 |
### Tab Props
+4 -4
View File
@@ -45,12 +45,12 @@ export default createComponent({
},
render(h) {
const { slots, isActive } = this;
const shouldRender = this.inited || this.parent.scrollspy || !this.parent.lazyRender;
const show = this.parent.scrollspy || isActive;
const { slots, parent, isActive } = this;
const shouldRender = this.inited || parent.scrollspy || !parent.lazyRender;
const show = parent.scrollspy || isActive;
const Content = shouldRender ? slots() : h();
if (this.parent.animated) {
if (parent.animated) {
return (
<div
role="tabpanel"