Answer the question
In order to leave comments, you need to log in
How to apply Pug array switching in Vue template?
I need to change pug arrays when switching language, but I can't figure out how to apply them.
Массивы:
<template lang="pug">
-
var activityListRu = [
{
i: 'account-switch',
t: '1'
},
{
i: 'account-search',
t: '2'
},
{
i: 'account-star',
t: '3'
}
]
-
var activityListEn = [
{
i: 'account-switch',
t: '4'
},
{
i: 'account-search',
t: '5'
},
{
i: 'account-star',
t: '6'
}
];
...
v-row.d-none.d-sm-flex.mb-4
each card in this.$root.$i18n.locale === "ru" ? activityListRu : activityListEn
v-col(cols='12', sm='4')
...
v-row.d-none.d-sm-flex.mb-4
each card in activityListLocale()
v-col(cols='12', sm='4')
...
methods: {
activityListLocale() {
if (this.$root.$i18n.locale === 'ru') {
return activityListRu
} else if (this.$root.$i18n.locale === 'en') {
return activityListEn
}
},
},
Answer the question
In order to leave comments, you need to log in
Gloom..
Why not take out arrays in data, make a calculated field and use it normally in a loop?
offtopic, but why even connect a template engine to vue when it is already a template engine for itself?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question