question_uniapp/pages/Setting/languages.vue

99 lines
2.2 KiB
Vue
Raw Normal View History

2025-06-06 03:08:19 +08:00
<template>
<view class="page">
2025-06-10 00:51:49 +08:00
<uni-nav-bar @clickLeft="goto(1, 1)" left-icon="back" :border="false" :shadow="false" :fixed="true"
title="Languages" backgroundColor="#fff"></uni-nav-bar>
2025-06-06 03:08:19 +08:00
<view class="cell_list" @click="changeLang('en')">
<view class="cell_left txt">English</view>
<view class="cell_right">
2025-06-10 00:51:49 +08:00
<uni-icons size="20" v-if="lang=='en'" style=" margin-left: 20rpx; color: blue;" type="checkbox-filled"></uni-icons>
2025-06-06 03:08:19 +08:00
</view>
</view>
<view class="cell_list" @click="changeLang('zh')">
<view class="cell_left txt">简体中文</view>
<view class="cell_right">
2025-06-10 00:51:49 +08:00
<uni-icons size="20" v-if="lang=='zh'" style=" margin-left: 20rpx; color: blue;" type="checkbox-filled"></uni-icons>
2025-06-06 03:08:19 +08:00
</view>
</view>
</view>
</template>
<script>
import {
mapState,
mapMutations
} from 'vuex';
export default {
data() {
return {
lang: 'en'
};
},
computed: {
...mapState(['userInfo'])
},
//第一次加载
onLoad(e) {
if(this.$i18n.locale=="en"){
this.lang = 'en';
}else{
this.lang = 'zh'
}
},
//页面显示
onShow() {},
//方法
methods: {
onPageJump(url) {
uni.navigateTo({
url: url+""
});
},
onTokenJump(url) {
this.judgeLogin(() => {
uni.navigateTo({
url: url
});
});
},
2025-06-10 00:51:49 +08:00
goto(url, type) {
if (type == 2) {
return uni.switchTab({ url: url })
}
if (type == 1) {
return uni.navigateBack({ delta: url });
}
uni.navigateTo({
url: url
})
},
2025-06-06 03:08:19 +08:00
changeLang(l){
this.$i18n.locale = l;
setTimeout(() => {
uni.navigateBack();
}, 500);
},
},
//页面隐藏
onHide() {},
//页面卸载
onUnload() {},
//页面下来刷新
onPullDownRefresh() {},
//页面上拉触底
onReachBottom() {},
//用户点击分享
onShareAppMessage(e) {
return this.wxShare();
}
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
body{background-color: #fff;}
.rechargeTitle{
2025-06-10 00:51:49 +08:00
font-weight: 400;font-size: 32rpx;color: #999999;line-height: 46rpx; text-align: center; margin-top: 60rpx;
2025-06-06 03:08:19 +08:00
}
.rechargeNet{
2025-06-10 00:51:49 +08:00
font-weight: 600;font-size: 40rpx;color: #333;line-height: 46rpx; text-align: center; margin-top: 40rpx;
2025-06-06 03:08:19 +08:00
}
</style>