语言设定小插件

master
lemon橪 2021-10-21 15:48:03 +08:00
parent b9aa720bea
commit 18ea8a4366
4 changed files with 106 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import util from '@/libs/util'
import * as filters from '@/utils/filters' // global filter import * as filters from '@/utils/filters' // global filter
import liliDialog from '@/views/lili-dialog' import liliDialog from '@/views/lili-dialog'
import i18nBox from '@/views/lili-components/i18n-translate'
import {md5} from '@/utils/md5.js'; import {md5} from '@/utils/md5.js';
Vue.config.devtools = true; Vue.config.devtools = true;
Vue.config.productionTip = false Vue.config.productionTip = false
@ -35,6 +36,7 @@ Vue.use(ViewUI, {
}); });
Vue.component('liliDialog',liliDialog) Vue.component('liliDialog',liliDialog)
Vue.component('i18nBox',i18nBox)

View File

@ -0,0 +1,51 @@
<template>
<div>
<Button @click="enable = true">语言设定</Button>
<Modal v-model="enable" draggable sticky scrollable :mask="false" :title="title">
<div>
<RadioGroup v-model="language">
<Radio :label="item.value || item.label" :key="index" v-for="(item,index) in data">
<span>{{item.title || item.name}}</span>
</Radio>
</RadioGroup>
</div>
</Modal>
</div>
</template>
<script>
export default {
/**
* data 循环的语言内容格式 [{'title':'test','value':'val'}]
*/
props: {
data: {
type: Array,
default: () => {
return [];
},
},
},
watch: {
/**
* 回调语言内容
*/
language(val) {
if (val) {
this.$emit("language", val);
}
},
},
data() {
return {
language: "", //
enable: false, //modal
title: "转换语言",
};
},
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -18,6 +18,7 @@ import {
} from "@/libs/axios"; } from "@/libs/axios";
import { setStore, getStore, removeStore } from "@/libs/storage"; import { setStore, getStore, removeStore } from "@/libs/storage";
import i18nBox from '@/views/lili-components/i18n-translate'
import util from "@/libs/util"; import util from "@/libs/util";
@ -34,7 +35,7 @@ Vue.use(VueLazyload, {
}); });
Vue.use(ViewUI); Vue.use(ViewUI);
Vue.component('i18nBox',i18nBox)
Vue.component("vue-qr", vueQr); //此处将vue-qr添加为全局组件 Vue.component("vue-qr", vueQr); //此处将vue-qr添加为全局组件
// 挂载全局使用的方法 // 挂载全局使用的方法

View File

@ -0,0 +1,51 @@
<template>
<div>
<Button @click="enable = true">语言设定</Button>
<Modal v-model="enable" draggable sticky scrollable :mask="false" :title="title">
<div>
<RadioGroup v-model="language">
<Radio :label="item.value || item.label" :key="index" v-for="(item,index) in data">
<span>{{item.title || item.name}}</span>
</Radio>
</RadioGroup>
</div>
</Modal>
</div>
</template>
<script>
export default {
/**
* data 循环的语言内容格式 [{'title':'test','value':'val'}]
*/
props: {
data: {
type: Array,
default: () => {
return [];
},
},
},
watch: {
/**
* 回调语言内容
*/
language(val) {
if (val) {
this.$emit("language", val);
}
},
},
data() {
return {
language: "", //
enable: false, //modal
title: "转换语言",
};
},
};
</script>
<style lang="scss" scoped>
</style>