拖旺项目:聊城公交辅助决策系统
master
2022-04-27 493930a42a2ea3e13905ffd8772cdb945baa7bcf
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
<template>
 <div class="c-title-home" :style="{width}">
     <div :class="`_${size}`" :style="img ? {background: `url(${img})no-repeat left/cover`} : ''">
        <div class="_content" :style="color ? {color} : ''">
            {{ content }}
        </div>
        <slot></slot>
        <div class="flex fz12" v-if="showDateFlag">
            <div class="mr10" @click="choseBtn(0)" :class="index==0?'col-lv':''">今日</div>
            <div class="mr10" @click="choseBtn(1)" :class="index==1?'col-lv':''">本周</div>
            <div class="mr10" @click="choseBtn(2)" :class="index==2?'col-lv':''">本月</div>
        </div>
        
        <div v-if="moreShow && link" class="_more" @click="handleClick">
            <span>More</span>
            <img src="../../../assets/newImg/icon_more.png" alt="">
        </div>
     </div>
 </div>
</template>
 
<script>
export default {
 name: 'titleHome',
 props: {
     img: String, // 自定义图片
     color: String, // content 文字颜色
     content: String,
     link: String,
     showDateFlag: {
         type: Boolean,
         default: true
     },
     size: {
        type: String,
        default: 'middle' 
     },
     width: {
         type: String,
         default: '482px'
 
     },
     moreShow: {
        type: Boolean,
        default: true
     }
 },
 data () {
    return {
        index:0
    }
 },
 methods: {
     handleClick() {
         this.$router.push(this.link)
     },
     choseBtn(num){
         if(this.index===num)return;
         this.index=num;
         this.$emit('choseDate',num)
     }
 }
}
</script>
 
<style lang="less" scoped>
.c-title-home {
    // border-bottom: 1px solid rgba(255,255,255,0.1);
    line-height: 34px;
    height:34px;
    ._middle, ._large, ._small {
        display: flex;
        width: 100%;
    }
    ._small {
        background:url("../../../assets/index/ctitle_small.png")no-repeat left/cover;
    }
    ._middle {
        background:url("../../../assets/index/ctitle.png")no-repeat left/cover;
    }
    ._large {
        background:url("../../../assets/index/bg_large.png")no-repeat left/cover;
 
    }
    
    color: #fff;
    ._content {
        padding-left: 30px;
        position: relative;
        font-weight: 600;
        height: 34px;
        font-family: 'PingFangSC';
        flex: 1;
    }
    ._more {
        margin-right: 10px;
        cursor: pointer;
        font-size: 12px;
        img {
            width: 12px;
            height: 12px;
        }
    }
}
 
</style>