zengh
2022-05-09 52c39f5e2711e5535b689b66dfa5e100c7882b7f
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
<template name="navBarTop">
    <!-- 自定义顶部导航栏 -->
    <!-- <view class="nav-bar-top" @click="gotoMyself()">
        <view class="nav-bar-top-left">
            <image :src="navBarImage" />
        </view>
        <view class="nav-bar-top-title">我要查</view>
    </view> -->
    
    <uni-nav-bar class="uni-nav-bar-info" :fixed="true"  :status-bar="true" >
        <view class="title" slot="default">{{title}}</view>
        <view slot="left" class="uni-nav-bar-left" @click="gotoMyself()">
            <image :src="avatarImage"></image>
        </view>
    </uni-nav-bar>
</template>
 
<script>
    import uniNavBar from '../../components/uni-nav-bar/uni-nav-bar.vue'
    export default{
        props:['title'],
        components:{uniNavBar},
        name:"navBarTop",
        data(){
            // console.log(title);
            return{
                avatarImage:this.$store.state.avatar,
            }
        },
        methods:{
            //跳转至我的页面
            gotoMyself(){
                uni.navigateTo({
                    url:'../myself/myself'
                    // animationType: 'pop-in',
                    // animationDuration: 200
                })
                
                // uni.navigateBack({
                //     delta:1,
                //     animationType:'pop-out',
                //     animationDuration:200
                // });
            }
        }
    }
</script>
 
<style lang="scss">
    .uni-nav-bar-info {
        // font-weight: 550;
        
        .title{
            position: fixed;
            right: 45%;
            font-weight: 550;
        }
        
        .uni-nav-bar-left{
            display: flex;
            justify-items: center;
            
            image{
                // background-color: #00BFFF;
                margin-left: 1rem;
                width: 1.8rem;
                height: 1.8rem;
                border-radius: 100px;
            }
        }
    }
</style>