From 3b803cd356e782e060334067bc6e4aec8b40a1ca Mon Sep 17 00:00:00 2001 From: "songwanli2025@163.com" Date: Wed, 19 Feb 2020 17:58:39 +0800 Subject: [PATCH] modify(tabs): mount resizeOberver by case --- src/Tabs/src/Tabs.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Tabs/src/Tabs.vue b/src/Tabs/src/Tabs.vue index 475ce90bc..5506cd01c 100644 --- a/src/Tabs/src/Tabs.vue +++ b/src/Tabs/src/Tabs.vue @@ -96,6 +96,7 @@ import iosArrowBack from '../../_icons/ios-arrow-back' import iosArrowForward from '../../_icons/ios-arrow-forward' import mdClose from '../../_icons/md-close' import resizeObserverDelegate from '../../_utils/delegate/resizeObserverDelegate' +import throttle from 'lodash-es/throttle' export default { name: 'NTabs', @@ -191,13 +192,15 @@ export default { this.updateScrollStatus() updateBarPosition.call(this) }) - resizeObserverDelegate.registerHandler(this.$refs.tab, () => { - this.transitionDisabled = true - updateBarPosition.call(this) - this.$nextTick().then(() => { - this.transitionDisabled = false - }) - }) + if (this.justifyContent === 'space-around' || this.justifyContent === 'space-evenly') { + resizeObserverDelegate.registerHandler(this.$refs.tab, throttle(() => { + this.transitionDisabled = true + updateBarPosition.call(this) + this.$nextTick().then(() => { + this.transitionDisabled = false + }) + }, 40)) + } }, updated () { this