fix(ui): [WIP] fix regression: use cursor keys for switching tabs
This commit is contained in:
parent
b78d1f8992
commit
25a892dec0
|
@ -15,10 +15,6 @@ provide(TABS_INJECTION_KEY, {
|
||||||
tabs: tabs,
|
tabs: tabs,
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentTab = computed(() =>
|
|
||||||
tabs.find(({title}) => title === currentTitle.value)
|
|
||||||
)
|
|
||||||
|
|
||||||
const currentIndex = computed(() =>
|
const currentIndex = computed(() =>
|
||||||
tabs.findIndex(({title}) => title === currentTitle.value)
|
tabs.findIndex(({title}) => title === currentTitle.value)
|
||||||
)
|
)
|
||||||
|
@ -37,8 +33,8 @@ watch(() => tabs.length, (_, from) => {
|
||||||
v-for="(tab, _) in tabs" :class="{ 'is-active': currentTitle === tab.title }"
|
v-for="(tab, _) in tabs" :class="{ 'is-active': currentTitle === tab.title }"
|
||||||
v-bind="tab"
|
v-bind="tab"
|
||||||
:onClick="() => { currentTitle = tab.title }"
|
:onClick="() => { currentTitle = tab.title }"
|
||||||
@keydown.left="currentTitle = tabs[(currentIndex - 1 + tabs.length) % tabs.length]"
|
@keydown.left="currentTitle = tabs[(currentIndex - 1 + tabs.length) % tabs.length].title"
|
||||||
@keydown.right="currentTitle = tabs[(currentIndex + 1) % tabs.length]"
|
@keydown.right="currentTitle = tabs[(currentIndex + 1) % tabs.length].title"
|
||||||
class="tabs-item"
|
class="tabs-item"
|
||||||
>
|
>
|
||||||
<div class="is-spacing">{{ tab.title }}</div>
|
<div class="is-spacing">{{ tab.title }}</div>
|
||||||
|
|
Loading…
Reference in New Issue