Skip to content

Commit c5fc2f5

Browse files
VdustRmarcosmoura
authored andcommitted
fix(MdTabs): correct indicator position while alignment changed (#1442)
`setIndicatorStyles` on `transitionend` for correct position while alignment changed fix #1432
1 parent 4722dad commit c5fc2f5

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/components/MdTabs/MdTabs.vue

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="md-tabs" :class="[tabsClasses, $mdActiveTheme]">
3-
<div class="md-tabs-navigation" :class="navigationClasses">
3+
<div class="md-tabs-navigation" :class="navigationClasses" ref="navigation">
44
<md-button
55
v-for="({ label, props, icon, disabled, data, events }, index) in MdTabs.items"
66
:key="index"
@@ -75,7 +75,8 @@
7575
hasContent: false,
7676
MdTabs: {
7777
items: {}
78-
}
78+
},
79+
alignmentChanging: false
7980
}),
8081
provide () {
8182
return {
@@ -112,8 +113,24 @@
112113
this.$emit('md-changed', tab)
113114
},
114115
async mdAlignment () {
116+
if (this.alignmentChanging) {
117+
return false
118+
}
119+
120+
this.alignmentChanging = true
115121
await this.$nextTick()
116-
this.setIndicatorStyles()
122+
123+
let cb = event => {
124+
if (event.propertyName !== 'min-width') {
125+
return false
126+
}
127+
128+
this.$refs.navigation.removeEventListener('transitionend', cb)
129+
this.setIndicatorStyles()
130+
this.alignmentChanging = false
131+
}
132+
133+
this.$refs.navigation.addEventListener('transitionend', cb)
117134
}
118135
},
119136
methods: {

0 commit comments

Comments
 (0)