zhangxiaoxu123456
2021-12-17 4d4a844ef624dde8667b314d353599297f6cb8d9
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
<template>
    <view class="nav-wrap">
        <view class="nav-title">
            <image class="logo" src="https://cdn.uviewui.com/uview/common/logo.png" mode="widthFix"></image>
            <view class="nav-info">
                <view class="nav-title__text">
                    {{$t('common.title')}}
                </view>
                <view class="nav-slogan">
                     {{$t('common.intro')}}
                </view>
            </view>
        </view>
        <view class="nav-desc">
            {{desc}}
        </view>
        <view class="lang" @tap="switchLang">
            <u-icon size="46" color="warning" :name="lang"></u-icon>
        </view>
    </view>
</template>
 
<script>
    export default {
        props: {
            desc: String,
            title: String,
        },
        computed: {
            lang() {
                return this.$i18n.locale == 'zh' ? 'zh' : 'en';
            }
        },
        methods: {
            switchLang() {
                this.$i18n.locale = this.$i18n.locale == 'en' ? 'zh' : 'en';
                this.vuex_tabbar[0].text = this.$t('nav.components')
                this.vuex_tabbar[1].text = this.$t('nav.js')
                this.vuex_tabbar[2].text = this.$t('nav.template')
                uni.setNavigationBarTitle({
                    title: this.$t(this.title)
                });
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .nav-wrap {
        padding: 15px;
        position: relative;
    }
    
    .lang {
        position: absolute;
        top: 15px;
        right: 15px;
    }
    
    .nav-title {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        flex-direction: row;
        align-items: center;
    }
    
    .nav-info {
        margin-left: 15px;
    }
    
    .nav-title__text {
        /* #ifndef APP-NVUE */
        display: flex;
        /* #endif */
        color: $u-main-color;
        font-size: 25px;
        font-weight: bold;
    }
    
    .logo {
        width: 70px;
        /* #ifndef APP-NVUE */
        height: auto;
        /* #endif */
    }
    
    .nav-slogan {
        color: $u-tips-color;
        font-size: 14px;
    }
    
    .nav-desc {
        margin-top: 10px;
        font-size: 14px;
        color: $u-content-color;
    }
</style>