fix(Tabs): incorrect scrollspy position while inside a scroller

This commit is contained in:
chenjiahan
2020-02-29 15:57:20 +08:00
parent d9d85a7c72
commit 0993b394b1
3 changed files with 24 additions and 14 deletions
+7 -5
View File
@@ -300,12 +300,14 @@ export default createComponent({
scrollToCurrentContent() {
if (this.scrollspy) {
this.clickedScroll = true;
const instance = this.children[this.currentIndex];
const el = instance && instance.$el;
const target = this.children[this.currentIndex];
const el = target?.$el;
if (el) {
const to = Math.ceil(getElementTop(el)) - this.scrollOffset;
scrollTopTo(to, +this.duration, () => {
const to = getElementTop(el, this.scroller) - this.scrollOffset;
this.clickedScroll = true;
scrollTopTo(this.scroller, to, +this.duration, () => {
this.clickedScroll = false;
});
}