当我在选择中通过 i18n 更改语言时,我需要立即更新
html
<base-dropdown-item
v-for="(f, i) in filters"
:key="`dropdown-${i}`"
@click="filter = f"
>{{ f.label }}</base-dropdown-item
打字稿
data() {
return {
q: '',
filter: { label: this.$t('myTasks.filter.Incomplete'), value: 2 },
filters: [
{ label: this.$t('myTasks.filter.Incomplete'), value: 2 },
{ label: this.$t('myTasks.filter.done'), value: 3 },
{ label: this.$t('myTasks.filter.all'), value: 1 }
],
qTasks: []
};
},
watch: {
'filter.value'() {
this.$emit('filter', this.filter);
},
};
当我需要刷新时,我需要实时更改语言