forked from AkkomaGang/akkoma-fe
#417: reset tab from the outside
This commit is contained in:
parent
3d30ad1dda
commit
5a0bb29f02
3 changed files with 5 additions and 9 deletions
|
@ -4,19 +4,12 @@ import './tab_switcher.scss'
|
||||||
|
|
||||||
export default Vue.component('tab-switcher', {
|
export default Vue.component('tab-switcher', {
|
||||||
name: 'TabSwitcher',
|
name: 'TabSwitcher',
|
||||||
props: ['refresh', 'renderOnlyFocused'],
|
props: ['renderOnlyFocused'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
active: this.$slots.default.findIndex(_ => _.tag)
|
active: this.$slots.default.findIndex(_ => _.tag)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
$route () {
|
|
||||||
if (this.refresh) {
|
|
||||||
this.active = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
activateTab (index) {
|
activateTab (index) {
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
@ -141,6 +141,9 @@ const UserProfile = {
|
||||||
}
|
}
|
||||||
this.cleanUp()
|
this.cleanUp()
|
||||||
this.startUp()
|
this.startUp()
|
||||||
|
},
|
||||||
|
$route () {
|
||||||
|
this.$refs.tabSwitcher.activateTab(0)()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
:switcher="true"
|
:switcher="true"
|
||||||
:selected="timeline.viewing"
|
:selected="timeline.viewing"
|
||||||
/>
|
/>
|
||||||
<tab-switcher :refresh="true" :renderOnlyFocused="true">
|
<tab-switcher :renderOnlyFocused="true" ref="tabSwitcher">
|
||||||
<Timeline
|
<Timeline
|
||||||
:label="$t('user_card.statuses')"
|
:label="$t('user_card.statuses')"
|
||||||
:disabled="!user.statuses_count"
|
:disabled="!user.statuses_count"
|
||||||
|
|
Loading…
Reference in a new issue