Skip to content

Commit

Permalink
feat: Addition to previous QRouteTab commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Oct 19, 2017
1 parent e53f8bb commit 2399d1d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dev/components/test-layout/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<q-route-tab slot="title" icon="view_quilt" to="/test-layout/about" replace hide="icon" label="About" />
<q-route-tab slot="title" icon="view_day" to="/test-layout/toolbar" replace hide="label" label="Toolbar" />
<q-route-tab slot="title" icon="view_day" to="/test-layout/tabs" replace label="Tabs" />
<q-route-tab slot="title" icon="input" to="/test-layout/drawer" replace label="Drawer" />
<q-route-tab slot="title" icon="input" to="/test-layout/drawerZZZ" replace label="Drawer" />
</q-tabs>

<q-scroll-area slot="left" style="width: 100%; height: 100%;" :thumb-style="{right: '4px', borderRadius: '5px', background: 'red', opacity: 1}">
Expand Down
4 changes: 2 additions & 2 deletions src/components/tab/QRouteTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default {
if (this.$el.classList.contains('router-link-active') || this.$el.classList.contains('router-link-exact-active')) {
this.selectTab(this.name)
}
else if (this.data.tabName === this.name) {
this.selectTab('')
else if (this.active) {
this.selectTab(null)
}
})
}
Expand Down
13 changes: 8 additions & 5 deletions src/components/tab/tab-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ export default {
color: String
},
inject: ['data', 'selectTab'],
computed: {
active () {
const sel = this.data.tabName === this.name
if (sel) {
watch: {
active (val) {
if (val) {
this.$emit('select', this.name)
}
return sel
}
},
computed: {
active () {
return this.data.tabName === this.name
},
classes () {
const cls = {
Expand Down

0 comments on commit 2399d1d

Please sign in to comment.