diff options
| author | Shpuld Shpludson <shp@cock.li> | 2020-09-08 09:46:19 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2020-09-08 09:46:19 +0000 |
| commit | 938887ef91a12dcaaaaa0884af4e76abd1c6c679 (patch) | |
| tree | 14d913a145a4e7bcb9221a38aea70410293ce69f /src/components/tab_switcher/tab_switcher.js | |
| parent | e768ec1fca2f7580d111b0878a9695b0c8b9dbb1 (diff) | |
| parent | f31bc5310e544cd6f960471659c5a83e1f1721be (diff) | |
Merge branch 'rc/2.1.1' into 'master'
Update master with 2.1.1
See merge request pleroma/pleroma-fe!1231
Diffstat (limited to 'src/components/tab_switcher/tab_switcher.js')
| -rw-r--r-- | src/components/tab_switcher/tab_switcher.js | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 40b5b3ca..9c1da354 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -60,16 +60,19 @@ export default Vue.component('tab-switcher', { } }, methods: { - activateTab (index) { + clickTab (index) { return (e) => { e.preventDefault() - if (typeof this.onSwitch === 'function') { - this.onSwitch.call(null, this.$slots.default[index].key) - } - this.active = index - if (this.scrollableTabs) { - this.$refs.contents.scrollTop = 0 - } + this.setTab(index) + } + }, + setTab (index) { + if (typeof this.onSwitch === 'function') { + this.onSwitch.call(null, this.$slots.default[index].key) + } + this.active = index + if (this.scrollableTabs) { + this.$refs.contents.scrollTop = 0 } } }, @@ -88,7 +91,7 @@ export default Vue.component('tab-switcher', { <div class={classesWrapper.join(' ')}> <button disabled={slot.data.attrs.disabled} - onClick={this.activateTab(index)} + onClick={this.clickTab(index)} class={classesTab.join(' ')}> <img src={slot.data.attrs.image} title={slot.data.attrs['image-tooltip']}/> {slot.data.attrs.label ? '' : slot.data.attrs.label} @@ -100,7 +103,7 @@ export default Vue.component('tab-switcher', { <div class={classesWrapper.join(' ')}> <button disabled={slot.data.attrs.disabled} - onClick={this.activateTab(index)} + onClick={this.clickTab(index)} class={classesTab.join(' ')} type="button" > |
