Skip to content

Commit 308b31c

Browse files
committed
feat: Addition to previous QRouteTab commit
1 parent cf94336 commit 308b31c

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

dev/components/test-layout/layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<q-route-tab slot="title" icon="view_quilt" to="/test-layout/about" replace hide="icon" label="About" />
3838
<q-route-tab slot="title" icon="view_day" to="/test-layout/toolbar" replace hide="label" label="Toolbar" />
3939
<q-route-tab slot="title" icon="view_day" to="/test-layout/tabs" replace label="Tabs" />
40-
<q-route-tab slot="title" icon="input" to="/test-layout/drawer" replace label="Drawer" />
40+
<q-route-tab slot="title" icon="input" to="/test-layout/drawerZZZ" replace label="Drawer" />
4141
</q-tabs>
4242

4343
<q-scroll-area slot="left" style="width: 100%; height: 100%;" :thumb-style="{right: '4px', borderRadius: '5px', background: 'red', opacity: 1}">

src/components/tab/QRouteTab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export default {
2222
if (this.$el.classList.contains('router-link-active') || this.$el.classList.contains('router-link-exact-active')) {
2323
this.selectTab(this.name)
2424
}
25-
else if (this.data.tabName === this.name) {
26-
this.selectTab('')
25+
else if (this.active) {
26+
this.selectTab(null)
2727
}
2828
})
2929
}

src/components/tab/tab-mixin.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ export default {
2727
color: String
2828
},
2929
inject: ['data', 'selectTab'],
30-
computed: {
31-
active () {
32-
const sel = this.data.tabName === this.name
33-
if (sel) {
30+
watch: {
31+
active (val) {
32+
if (val) {
3433
this.$emit('select', this.name)
3534
}
36-
return sel
35+
}
36+
},
37+
computed: {
38+
active () {
39+
return this.data.tabName === this.name
3740
},
3841
classes () {
3942
const cls = {

0 commit comments

Comments
 (0)