mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add computed for selected locale to avoide additional pipe
This commit is contained in:
parent
46626441d4
commit
c6a6c470d0
@ -22,8 +22,14 @@
|
||||
:class="$store.state.language === lang.code ? 'c-grey' : 'c-blau'"
|
||||
>
|
||||
<span v-if="lang.code !== $store.state.language" class="locales">{{ lang.name }}</span>
|
||||
|
||||
<span v-if="lang.code !== $store.state.language" class="ml-3 mr-3">
|
||||
<span
|
||||
v-if="
|
||||
lang.code !== $store.state.language &&
|
||||
(indexOfSelectedLocale !== indexOfLastLocale ||
|
||||
(indexOfSelectedLocale === indexOfLastLocale && index !== indexOfSecondLastLocale))
|
||||
"
|
||||
class="ml-3 mr-3"
|
||||
>
|
||||
{{ locales.length - 1 > index ? $t('math.pipe') : '' }}
|
||||
</span>
|
||||
</span>
|
||||
@ -86,6 +92,17 @@ export default {
|
||||
this.currentLanguage = object
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
indexOfSelectedLocale() {
|
||||
return this.locales.findIndex((element) => element.code === this.$store.state.language)
|
||||
},
|
||||
indexOfSecondLastLocale() {
|
||||
return this.locales.length - 2
|
||||
},
|
||||
indexOfLastLocale() {
|
||||
return this.locales.length - 1
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.setCurrentLanguage()
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user