Skip to content

Commit b3b2c07

Browse files
committed
update:添加版本显示
1 parent 32a4550 commit b3b2c07

File tree

1 file changed

+76
-71
lines changed

1 file changed

+76
-71
lines changed

components/page-nav/page-nav.vue

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<image class="logo" src="https://cdn.uviewui.com/uview/common/logo.png" mode="widthFix"></image>
55
<view class="nav-info">
66
<view class="nav-title__text">
7-
{{$t('common.title')}}
7+
<text class="nav-info__title__text">uView {{version}}</text>
88
</view>
99
<view class="nav-slogan">
10-
{{$t('common.intro')}}
10+
{{$t('common.intro')}}
1111
</view>
1212
</view>
1313
</view>
@@ -21,78 +21,83 @@
2121
</template>
2222

2323
<script>
24-
export default {
25-
props: {
26-
desc: String,
27-
title: String,
28-
},
29-
computed: {
30-
lang() {
31-
return this.$i18n.locale == 'zh' ? 'zh' : 'en';
32-
}
33-
},
34-
methods: {
35-
switchLang() {
36-
this.$i18n.locale = this.$i18n.locale == 'en' ? 'zh' : 'en';
37-
this.vuex_tabbar[0].text = this.$t('nav.components')
38-
this.vuex_tabbar[1].text = this.$t('nav.js')
39-
this.vuex_tabbar[2].text = this.$t('nav.template')
40-
uni.setNavigationBarTitle({
41-
title: this.$t(this.title)
42-
});
43-
}
24+
export default {
25+
props: {
26+
desc: String,
27+
title: String,
28+
},
29+
computed: {
30+
lang() {
31+
return this.$i18n.locale == 'zh' ? 'zh' : 'en';
32+
}
33+
},
34+
data() {
35+
return {
36+
version: uni.$u.config.v
37+
}
38+
},
39+
methods: {
40+
switchLang() {
41+
this.$i18n.locale = this.$i18n.locale == 'en' ? 'zh' : 'en';
42+
this.vuex_tabbar[0].text = this.$t('nav.components')
43+
this.vuex_tabbar[1].text = this.$t('nav.js')
44+
this.vuex_tabbar[2].text = this.$t('nav.template')
45+
uni.setNavigationBarTitle({
46+
title: this.$t(this.title)
47+
});
4448
}
4549
}
50+
}
4651
</script>
4752

4853
<style lang="scss" scoped>
49-
.nav-wrap {
50-
padding: 15px;
51-
position: relative;
52-
}
53-
54-
.lang {
55-
position: absolute;
56-
top: 15px;
57-
right: 15px;
58-
}
59-
60-
.nav-title {
61-
/* #ifndef APP-NVUE */
62-
display: flex;
63-
/* #endif */
64-
flex-direction: row;
65-
align-items: center;
66-
}
67-
68-
.nav-info {
69-
margin-left: 15px;
70-
}
71-
72-
.nav-title__text {
73-
/* #ifndef APP-NVUE */
74-
display: flex;
75-
/* #endif */
76-
color: $u-main-color;
77-
font-size: 25px;
78-
font-weight: bold;
79-
}
80-
81-
.logo {
82-
width: 70px;
83-
/* #ifndef APP-NVUE */
84-
height: auto;
85-
/* #endif */
86-
}
87-
88-
.nav-slogan {
89-
color: $u-tips-color;
90-
font-size: 14px;
91-
}
92-
93-
.nav-desc {
94-
margin-top: 10px;
95-
font-size: 14px;
96-
color: $u-content-color;
97-
}
54+
.nav-wrap {
55+
padding: 15px;
56+
position: relative;
57+
}
58+
59+
.lang {
60+
position: absolute;
61+
top: 15px;
62+
right: 15px;
63+
}
64+
65+
.nav-title {
66+
/* #ifndef APP-NVUE */
67+
display: flex;
68+
/* #endif */
69+
flex-direction: row;
70+
align-items: center;
71+
}
72+
73+
.nav-info {
74+
margin-left: 15px;
75+
}
76+
77+
.nav-title__text {
78+
/* #ifndef APP-NVUE */
79+
display: flex;
80+
/* #endif */
81+
color: $u-main-color;
82+
font-size: 25px;
83+
font-weight: bold;
84+
}
85+
86+
.logo {
87+
width: 70px;
88+
/* #ifndef APP-NVUE */
89+
height: auto;
90+
/* #endif */
91+
}
92+
93+
.nav-slogan {
94+
color: $u-tips-color;
95+
font-size: 14px;
96+
}
97+
98+
.nav-desc {
99+
margin-top: 10px;
100+
font-size: 14px;
101+
color: $u-content-color;
102+
}
98103
</style>

0 commit comments

Comments
 (0)