From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 components/js-lang/js-lang.vue |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/components/js-lang/js-lang.vue b/components/js-lang/js-lang.vue
new file mode 100644
index 0000000..42ed73b
--- /dev/null
+++ b/components/js-lang/js-lang.vue
@@ -0,0 +1,69 @@
+<template>
+	<view v-if="showBtn" class="js-lang" @tap="switchLang">
+		<u-icon size="46" color="warning" :name="lang"></u-icon>
+	</view>
+</template>
+<script>
+/**
+ * 璇█鍒囨崲缁勪欢
+ * @property {String} title 椤堕儴瀵艰埅鐨勬爣棰� i18n 缂栫爜
+ * @property {Boolean} showBtn 鏄惁鏄剧ず璇█鍒囨崲鎸夐挳
+ * @example <js-lang title="login.title" :showBtn="true"></js-lang>
+ * @description Copyright (c) 2013-Now http://jeesite.com All rights reserved.
+ * @author ThinkGem
+ * @version 2021-3-11
+ */
+export default {
+	props: {
+		title: {
+			type: String,
+			default: ''
+		},
+		showBtn: {
+			type: Boolean,
+			default: false
+		}		
+	},
+	computed: {
+		lang() {
+			return this.$i18n.locale == 'zh_CN' ? 'zh' : 'en';
+		}
+	},
+	created(){
+		this.setBarTitle();
+	},
+	methods: {
+		switchLang() {
+			this.$i18n.locale = this.$i18n.locale == 'zh_CN' ? 'en' : 'zh_CN';
+			this.$u.vuex('vuex_locale', this.$i18n.locale);
+			this.$u.api.lang({lang: this.vuex_locale});
+			this.setBarTitle();
+		},
+		setBarTitle (){
+			uni.setNavigationBarTitle({
+				title: this.$t(this.title)
+			});
+			uni.setTabBarItem({
+				index: 0,
+				text: this.$t('nav.log')
+			});
+			uni.setTabBarItem({
+				index: 1,
+				text: this.$t('nav.home')
+			});
+			uni.setTabBarItem({
+				index: 2,
+				text: this.$t('nav.user')
+			});
+		}
+	}
+}
+</script>
+<style lang="scss" scoped>
+.js-lang {
+	position: absolute;
+	z-index: 10000;
+	top: 15px;
+	right: 15px;
+}
+</style>

--
Gitblit v1.9.3