34 lines
773 B
Vue
34 lines
773 B
Vue
<template>
|
|
<div class="admin-language">
|
|
<select v-model="selectedLocale">
|
|
<option v-for="item in locale" :value="item.value">{{item.name}}</option>
|
|
</select>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
selectedLocale: 'fa'
|
|
}
|
|
},
|
|
computed: {
|
|
locale() {
|
|
return this.$store.state.admin.languages
|
|
}
|
|
},
|
|
created() {
|
|
this.$axios.get('/api/public/locale')
|
|
.then(response => {
|
|
this.$store.commit('admin/updateLanguages', response.data)
|
|
})
|
|
},
|
|
watch: {
|
|
selectedLocale(oldVal, newVal) {
|
|
this.$store.commit('admin/changeLocale', this.selectedLocale)
|
|
}
|
|
}
|
|
}
|
|
</script>
|