De-duplicate HTML for tab content, add way for tab to request scroll to top
This commit is contained in:
parent
a89306b3b8
commit
d2c9122720
2 changed files with 15 additions and 22 deletions
|
|
@ -56,29 +56,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Corresponding vertical tab content -->
|
<!-- Corresponding vertical tab content -->
|
||||||
<div id="container-left" class="uk-padding-remove uk-height-1-1 uk-width-expand">
|
<div
|
||||||
<!-- For each top tab -->
|
id="container-left"
|
||||||
|
ref="containerLeft"
|
||||||
|
class="uk-padding-remove uk-height-1-1 uk-width-expand"
|
||||||
|
>
|
||||||
<tabContent
|
<tabContent
|
||||||
v-for="item in topTabs"
|
v-for="item in allTabs"
|
||||||
:id="item.id + '-tab-content'"
|
:id="item.id + '-tab-content'"
|
||||||
:key="item.id + '-tab-content'"
|
:key="item.id + '-tab-content'"
|
||||||
:tab-i-d="item.id"
|
:tab-i-d="item.id"
|
||||||
:require-connection="true"
|
:require-connection="true"
|
||||||
:current-tab="currentTab"
|
:current-tab="currentTab"
|
||||||
>
|
>
|
||||||
<component :is="item.component"></component>
|
<component :is="item.component" @scrollTop="scrollToTop"></component>
|
||||||
</tabContent>
|
|
||||||
|
|
||||||
<!-- For each bottom tab -->
|
|
||||||
<tabContent
|
|
||||||
v-for="item in bottomTabs"
|
|
||||||
:id="item.id + '-tab-content'"
|
|
||||||
:key="item.id + '-tab-content'"
|
|
||||||
:tab-i-d="item.id"
|
|
||||||
:require-connection="true"
|
|
||||||
:current-tab="currentTab"
|
|
||||||
>
|
|
||||||
<component :is="item.component"></component>
|
|
||||||
</tabContent>
|
</tabContent>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -195,7 +186,9 @@ export default {
|
||||||
}
|
}
|
||||||
return tabs;
|
return tabs;
|
||||||
},
|
},
|
||||||
|
allTabs() {
|
||||||
|
return [...this.topTabs, ...this.bottomTabs];
|
||||||
|
},
|
||||||
currentTabIndex: function() {
|
currentTabIndex: function() {
|
||||||
return this.tabOrder.indexOf(this.currentTab);
|
return this.tabOrder.indexOf(this.currentTab);
|
||||||
},
|
},
|
||||||
|
|
@ -238,6 +231,9 @@ export default {
|
||||||
enterApp: function() {
|
enterApp: function() {
|
||||||
// Stuff to do once connected and all init modals are finished
|
// Stuff to do once connected and all init modals are finished
|
||||||
},
|
},
|
||||||
|
scrollToTop() {
|
||||||
|
this.$refs.containerLeft.scrollTo({ top: 0 });
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
:page-class="'page-item'"
|
:page-class="'page-item'"
|
||||||
:active-class="'uk-active'"
|
:active-class="'uk-active'"
|
||||||
:disabled-class="'uk-disabled'"
|
:disabled-class="'uk-disabled'"
|
||||||
:click-handler="scrollToTop()"
|
:click-handler="scrollToTop"
|
||||||
>
|
>
|
||||||
</Paginate>
|
</Paginate>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -135,10 +135,7 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
scrollToTop() {
|
scrollToTop() {
|
||||||
const el = document.querySelector("#container-left");
|
this.$emit("scrollTop");
|
||||||
if (el) {
|
|
||||||
el.scrollTop = 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
visibilityChanged(isVisible) {
|
visibilityChanged(isVisible) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue