diff options
| author | Henry Jameson <me@hjkos.com> | 2020-05-25 14:16:03 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2020-05-25 14:16:03 +0300 |
| commit | 79c03984bcf63387863f6979849c39ff5f404186 (patch) | |
| tree | 5d8df644d165413e77d655251ac60a71b88b12d6 /src/components/tab_switcher | |
| parent | 6a4ad1fe624b2e2da68707ffffcc6a4cbe7e5e03 (diff) | |
scroll to top when switching tabs
Diffstat (limited to 'src/components/tab_switcher')
| -rw-r--r-- | src/components/tab_switcher/tab_switcher.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index a54b474f..bd1f51cb 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -60,6 +60,9 @@ export default Vue.component('tab-switcher', { this.onSwitch.call(null, this.$slots.default[index].key) } this.active = index + if (this.scrollableTabs) { + this.$refs.contents.scrollTop = 0 + } } } }, @@ -118,7 +121,7 @@ export default Vue.component('tab-switcher', { <div class="tabs"> {tabs} </div> - <div class={'contents' + (this.scrollableTabs ? ' scrollable-tabs' : '')}> + <div ref="contents" class={'contents' + (this.scrollableTabs ? ' scrollable-tabs' : '')}> {contents} </div> </div> |
