Skip to content
Snippets Groups Projects

Resolve "Fix language select dropdown on Vue-enabled pages"

Merged Hangzhi Yu requested to merge 718-fix-language-select-dropdown-on-vue-enabled-pages into master
1 file
+ 14
11
Compare changes
  • Side-by-side
  • Inline
@@ -12,11 +12,12 @@
:value="next_url"
type="hidden"
></v-text-field>
<input
<v-text-field
v-show="false"
v-model="language"
name="language"
:value="current_language"
type="hidden"
>
></v-text-field>
<v-menu offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn
@@ -26,16 +27,16 @@
color="primary"
>
<v-icon icon color="white">mdi-translate</v-icon>
{{ current_language }}
{{ language }}
</v-btn>
</template>
<v-list id="language-dropdown" class="dropdown-content">
<v-list-item-group
v-model="current_language"
v-model="language"
color="primary"
>
<v-list-item v-for="language in items" :key="language[0]" :value="language[0]" @click="submit(language[0])">
<v-list-item-title>{{ language[1] }}</v-list-item-title>
<v-list-item v-for="language_option in items" :key="language_option[0]" :value="language_option[0]" @click="submit(language_option[0])">
<v-list-item-title>{{ language_option[1] }}</v-list-item-title>
</v-list-item>
</v-list-item-group>
</v-list>
@@ -47,12 +48,14 @@
export default {
data: () => ({
items: JSON.parse(document.getElementById("language-info-list").textContent),
current_language: JSON.parse(document.getElementById("current-language").textContent),
language: JSON.parse(document.getElementById("current-language").textContent),
}),
methods: {
submit: function (language) {
this.current_language = language;
// this.$refs.form.submit()
submit: function (new_language) {
this.language = new_language;
this.$nextTick(() => {
this.$refs.form.submit();
});
},
},
props: ["action", "csrf_value", "next_url"],
Loading