index.vue
2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
<div class="setting_container">
<NafmHeader />
<div class="setting_list">
<div class="li">
<div class="menu_left">{{$t("setting.newMsgTip")}}</div>
<van-switch v-model="msgChecked" @click="changeMsgStatus" />
</div>
<div class="li">
<div class="menu_left">多语言</div>
<div class="menu_right" @click="popZhEn">
<div class="text">{{$t("lang")}}</div>
<div class="iconfont iconright"></div>
</div>
</div>
</div>
<van-overlay :show="showZhEn" z-index="10" @click="showZhEn = false">
<div class="footer">
<!-- <div class="btn"> -->
<div class="btn_zh item" @click="changeLang('zh')">中文</div>
<div class="btn_en item" @click="changeLang('en')">英文</div>
<div class="cancel item">取消</div>
<!-- </div> -->
</div>
</van-overlay>
</div>
</template>
<script>
import { setLocalStorage } from '@/utils/LocalStorage'
export default {
name: 'Setting',
data() {
return {
msgChecked: false,
showZhEn: false
}
},
mounted() {
this.msgChecked = true
},
methods: {
// 切换消息操作
changeMsgStatus() {
this.msgChecked = !this.msgChecked
},
// 弹出 设置中英文框
popZhEn() {
this.showZhEn = true
},
changeLang(val) {
console.log('val', val)
setLocalStorage('lang', val)
this.$i18n.locale = val
}
}
}
</script>
<style lang="less" scoped>
.setting_container {
background-color: #efefef;
height: 100vh;
}
.setting_list {
.li {
padding: 0 25px;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #ccc;
height: 95px;
.menu_left {
color: #333;
display: flex;
justify-content: space-between;
align-items: center;
}
.menu_right {
flex: 1;
display: flex;
justify-content: flex-end;
align-items: center;
.text {
color: #333;
}
.iconfont {
color: #ccc;
}
}
}
}
.footer {
position: fixed;
bottom: 20px;
display: flex;
width: 100%;
justify-content: center;
flex-direction: column;
align-items: center;
.item {
background-color: #fff;
height: 80px;
line-height: 80px;
width: 90%;
text-align: center;
}
.btn_zh {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom: 1px solid #efefef;
}
.btn_en {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
margin-bottom: 10px;
}
.cancel {
border-radius: 10px;
}
}
</style>