Skip to content

Commit 1ab2e10

Browse files
committed
fix: tabs scrollToActiveTab no work when add tab #215
1 parent 9f70380 commit 1ab2e10

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/vc-tabs/src/ScrollableTabBarNode.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ export default {
1616
prefixCls: PropTypes.string.def(''),
1717
scrollAnimated: PropTypes.bool.def(true),
1818
navWrapper: PropTypes.func.def(arg => arg),
19+
activeKey: PropTypes.any,
1920
},
2021

2122
data () {
2223
this.offset = 0
23-
this.prevProps = this.$props
24+
this.prevProps = { ...this.$props }
2425
return {
2526
next: false,
2627
prev: false,
@@ -41,7 +42,7 @@ export default {
4142
updated () {
4243
this.$nextTick(() => {
4344
this.updatedCal(this.prevProps)
44-
this.prevProps = this.$props
45+
this.prevProps = { ...this.$props }
4546
})
4647
},
4748

@@ -68,11 +69,10 @@ export default {
6869
this.setOffset(0)
6970
return
7071
}
71-
const nextPrev = this.setNextPrev()
7272
// wait next, prev show hide
7373
/* eslint react/no-did-update-set-state:0 */
74-
if (this.isNextPrevShown(this.$data) !== this.isNextPrevShown(nextPrev)) {
75-
this.$foreceUpdate()
74+
if (this.isNextPrevShown(this.$data) !== this.isNextPrevShown(this.setNextPrev())) {
75+
this.$forceUpdate()
7676
this.$nextTick(() => {
7777
this.scrollToActiveTab()
7878
})

0 commit comments

Comments
 (0)