diff options
| author | Henry Jameson <me@hjkos.com> | 2019-08-12 20:01:38 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-08-12 20:03:48 +0300 |
| commit | 5851f97eb058b3e2df91f9122ba899bc7e4affaf (patch) | |
| tree | 3e635d2a5f6d9755b24d5331a7a97043755d9ecb /src/components/tab_switcher/tab_switcher.js | |
| parent | 579b5c9e77154db5fe1bc712969b6fa39830442f (diff) | |
fixed a lot of bugs with emoji picker, improved relevant components
Diffstat (limited to 'src/components/tab_switcher/tab_switcher.js')
| -rw-r--r-- | src/components/tab_switcher/tab_switcher.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index a5fe019c..99428044 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -4,7 +4,26 @@ import './tab_switcher.scss' export default Vue.component('tab-switcher', { name: 'TabSwitcher', - props: ['renderOnlyFocused', 'onSwitch', 'customActive'], + props: { + renderOnlyFocused: { + required: false, + type: Boolean, + default: false + }, + onSwitch: { + required: false, + type: Function + }, + customActive: { + required: false, + type: String + }, + scrollableTabs: { + required: false, + type: Boolean, + default: false + } + }, data () { return { active: this.$slots.default.findIndex(_ => _.tag) @@ -18,7 +37,8 @@ export default Vue.component('tab-switcher', { }, methods: { activateTab (index, dataset) { - return () => { + return (e) => { + e.preventDefault() if (typeof this.onSwitch === 'function') { this.onSwitch.call(null, index, this.$slots.default[index].elm.dataset) } @@ -85,7 +105,7 @@ export default Vue.component('tab-switcher', { <div class="tabs"> {tabs} </div> - <div class="contents"> + <div class={'contents' + (this.scrollableTabs ? ' scrollable-tabs' : '')}> {contents} </div> </div> |
