mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 02:45:49 +02:00
[frontend-next] Refactored fronted
This commit is contained in:
parent
2f91918f54
commit
2fff1f5181
193 changed files with 3920 additions and 26548 deletions
|
@ -1,32 +1,38 @@
|
|||
<script setup lang="ts">
|
||||
import gettext from '@/gettext'
|
||||
|
||||
|
||||
import {ref, watch} from 'vue'
|
||||
|
||||
import {useSettingsStore} from '@/pinia'
|
||||
import {useRoute} from 'vue-router'
|
||||
|
||||
const settings = useSettingsStore()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const current = ref(gettext.current)
|
||||
|
||||
const languageAvailable = gettext.available
|
||||
watch(current, (v) => {
|
||||
settings.set_language(v)
|
||||
gettext.current = v
|
||||
// @ts-ignored
|
||||
document.title = route.name() + ' | Nginx UI'
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<a-select v-model="current" size="small" style="width: 50px">
|
||||
<a-select-option v-for="(language, key) in $language.available" :value="key" :key="key">
|
||||
<a-select v-model:value="current" size="small" style="width: 60px">
|
||||
<a-select-option v-for="(language, key) in languageAvailable" :value="key" :key="key">
|
||||
{{ language }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SetLanguage',
|
||||
data() {
|
||||
return {
|
||||
current: this.$language.current,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
current() {
|
||||
this.$store.commit('set_language', this.current)
|
||||
this.$nextTick(() => {
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue