<template>
	<view class="">
		<navigation :showBack="true" :bgnum="true">
			Language
		</navigation>
		<view class="main">
			<view class="main_con">
   
		
		 	
		<u-radio-group v-model="value" @change="radioGroupChange">
			 <view class="item flex" v-for="(item, index) in list" :key="index" @click="nowLanguage(item)">
			<view class="text1">
			 {{item.lang}}
			</view>
					<u-radio 
						@change="radioChange" 					
						:name="item.name"
						:disabled="item.disabled"
						active-color="#5B53FF"
					>
					
					</u-radio>
						 </view>
				</u-radio-group>
	<view class="select_btn">
		{{ i18n.langSelect }}
	</view>
		</view>
			</view>
		
	</view>
	
</template>

<script>
	import cont from "@/components/navigation/navigation.vue"
	export default {
		data() {
			return {
				language: this.$store.state.language == 'en' ? 'English' : '简体中文' ,
			checked: false,
					list: [
									{
										lang:'繁体中文',
										disabled: false,
										name:"b"
									},
									{
										lang:'简体中文',
										disabled: false,
										name:"a"
									},
									{
										lang:'English',
										disabled: false,
										name:"c"
									},
								
								],
								// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
								value: '',
			};
		},
		
		methods: {
		// 中英化
		// 判断当前是什么语言
		nowLanguage(e) {
			console.log(e)
			if (e.lang == 'English') {
				this._i18n.locale = 'en'
				this.$store.commit('setLanguage', 'en')
				uni.setStorageSync("language", 'en')
			} else if (e.lang == '简体中文') {
				this._i18n.locale = 'zh-CN'
				this.$store.commit('setLanguage', 'zh-CN')
				uni.setStorageSync("language", 'zh-CN')
			}else{
				this._i18n.locale = 'zh-CNF'
				this.$store.commit('setLanguage', 'zh-CNF')
				uni.setStorageSync("language", 'zh-CNF')
			}
			},
				radioChange(e) {
					
					},
					// 选中任一radio时，由radio-group触发
					radioGroupChange(e) {
					
					},
		change(status) {
					
					},
		},
	computed: {
		i18n() {
			return this.$t('index')
		},
	}
	};
</script>
<style scoped>
page {
		background: #FAFAFA;
	}
</style>

<style>

	@import './index.css';

</style>
