mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-17 04:00:48 +01:00
feat(UI): automatic scroll on selected tab
This commit is contained in:
parent
065de3a0a2
commit
e834fe31ac
@ -18,6 +18,7 @@
|
||||
<li
|
||||
v-for="(tab, i) of draggableTabs"
|
||||
:key="i"
|
||||
:ref="selectedTab === tab.uid ? 'tab-selected' : ''"
|
||||
class="tab-item tab-draggable"
|
||||
draggable="true"
|
||||
:class="{'active': selectedTab === tab.uid}"
|
||||
@ -361,7 +362,7 @@ export default {
|
||||
return false;
|
||||
},
|
||||
selectedTab () {
|
||||
return this.workspace.selectedTab;
|
||||
return this.workspace.selectedTab || null;
|
||||
},
|
||||
queryTabs () {
|
||||
return this.workspace.tabs.filter(tab => tab.type === 'query');
|
||||
@ -374,6 +375,20 @@ export default {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selectedTab (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
setTimeout(() => {
|
||||
const element = this.$refs['tab-selected'] ? this.$refs['tab-selected'][0] : null;
|
||||
if (element) {
|
||||
element.setAttribute('tabindex', '-1');
|
||||
element.focus();
|
||||
element.removeAttribute('tabindex');
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
await this.addWorkspace(this.connection.uid);
|
||||
const isInitiated = await Connection.checkConnection(this.connection.uid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user