Skip to content

Commit 253cb80

Browse files
committed
feat(QTabs): do not animate posbar if first tab being selected
1 parent 77e2d38 commit 253cb80

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

dev/components/components/tabs-playground.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<q-btn class="fit" size="sm" color="secondary" @click="$router.push('/tabs/b#123')" label="/tabs/b#123 - select no tab" />
5757
</div>
5858
</div>
59-
<q-tabs class="test q-mt-sm" @input="onEvent('input', 'route', $event)" @change="onEvent('change', 'route', $event)" @select="onEvent('select', 'route', $event)" @click="onEvent('click', 'route', $event)">
59+
<q-tabs class="test q-mt-sm" @input="onEvent('input', 'route', $event)" @select="onEvent('select', 'route', $event)" @click="onEvent('click', 'route', $event)">
6060
<q-route-tab slot="title" name="tabs" to="/tabs" exact label="/tabs" />
6161
<q-route-tab slot="title" name="tabs/a" to="/tabs/a" exact label="/tabs/a" />
6262
<q-route-tab slot="title" name="tabs/a *" to="/tabs/a" label="/tabs/a *" />

src/components/tab/QTabs.vue

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,29 +156,33 @@ export default {
156156
},
157157
methods: {
158158
selectTab (value) {
159+
console.log('selectTab', value)
159160
if (this.data.tabName === value) {
160161
return
161162
}
162163
163164
this.data.tabName = value
164-
this.$emit('select', value)
165-
166165
this.$emit('input', value)
167-
this.$nextTick(() => {
168-
if (JSON.stringify(value) !== JSON.stringify(this.value)) {
169-
this.$emit('change', value)
170-
}
171-
})
166+
this.$emit('select', value)
172167
173168
const el = this.__getTabElByName(value)
174169
175170
if (el) {
176171
this.__scrollToTab(el)
177-
}
178172
179-
if (__THEME__ !== 'ios') {
180-
this.currentEl = el
181-
this.__repositionBar()
173+
if (__THEME__ !== 'ios') {
174+
this.currentEl = el
175+
176+
if (this.oldEl) {
177+
this.__repositionBar()
178+
}
179+
else {
180+
this.oldEl = el
181+
}
182+
}
183+
}
184+
else {
185+
this.oldEl = null
182186
}
183187
},
184188
selectTabRouter (params) {

0 commit comments

Comments
 (0)