fix: tabs scrollToActiveTab no work when add tab #215
parent
9f70380bd8
commit
1ab2e106bf
|
@ -16,11 +16,12 @@ export default {
|
||||||
prefixCls: PropTypes.string.def(''),
|
prefixCls: PropTypes.string.def(''),
|
||||||
scrollAnimated: PropTypes.bool.def(true),
|
scrollAnimated: PropTypes.bool.def(true),
|
||||||
navWrapper: PropTypes.func.def(arg => arg),
|
navWrapper: PropTypes.func.def(arg => arg),
|
||||||
|
activeKey: PropTypes.any,
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
this.offset = 0
|
this.offset = 0
|
||||||
this.prevProps = this.$props
|
this.prevProps = { ...this.$props }
|
||||||
return {
|
return {
|
||||||
next: false,
|
next: false,
|
||||||
prev: false,
|
prev: false,
|
||||||
|
@ -41,7 +42,7 @@ export default {
|
||||||
updated () {
|
updated () {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.updatedCal(this.prevProps)
|
this.updatedCal(this.prevProps)
|
||||||
this.prevProps = this.$props
|
this.prevProps = { ...this.$props }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -68,11 +69,10 @@ export default {
|
||||||
this.setOffset(0)
|
this.setOffset(0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const nextPrev = this.setNextPrev()
|
|
||||||
// wait next, prev show hide
|
// wait next, prev show hide
|
||||||
/* eslint react/no-did-update-set-state:0 */
|
/* eslint react/no-did-update-set-state:0 */
|
||||||
if (this.isNextPrevShown(this.$data) !== this.isNextPrevShown(nextPrev)) {
|
if (this.isNextPrevShown(this.$data) !== this.isNextPrevShown(this.setNextPrev())) {
|
||||||
this.$foreceUpdate()
|
this.$forceUpdate()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.scrollToActiveTab()
|
this.scrollToActiveTab()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue