zxl
6 小时以前 172933f098017bc4c4f57dcda0d490ea12bb13bb
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
  <Card class="_Card" :bordered="false" :dis-hover="true">
    <div slot="title" class="cardTitle">
      <span :style="{fontSize:`${_Size}px`}">{{_Title}}</span>
 
      <div v-if="_Tabs" class="cardTabs">
        <div @click="tabsChange(index)" :class="{active:(isActive==index)}" class="cardTabsItem" :style="{fontSize:`${_Size-2}px`}" v-for="(item,index) in _Tabs"
             :key="index">
          {{item}}
        </div>
      </div>
    </div>
    <div slot="extra" class="cardExtra" v-if="_More" @click="callBack()">
      {{_More}}
    </div>
    <div>
 
    </div>
  </Card>
</template>
 
<script>
export default {
  name: 'index',
  props:
    {
      _Tabs: { // 可点击的tab栏
        type: null,
        default: ''
      },
      // 头部
      _Title: { // 标题
        type: null,
        default: '卡片头部'
      },
      // 右侧更多
      _More: {
        type: null,
        default: false
      },
      _Size: { // 文字大小
        type: Number,
        default: 16
      },
      // 点击更多触发跳转
      _Src: {
        type: null,
        default: function (val) {
          if (this._More) {
            return val;
          } else {
            return false;
          }
        }
      }
    },
  data () {
    return {
      isActive: 0 // 已激活tab栏下标
    };
  },
  methods: {
    // 点击右侧的回调
    callBack () {
      let _this = this;
      if (this._Src !== '' || this._Src != null) {
        this.$router.push({
          path: _this._Src
        });
      }
    },
    // 点击tab的回调
    tabsChange (index) {
    //  处理并返回index
      this.isActive = index;
      this.$emit('_Change', index);
    }
  }
};
</script>
 
<style scoped lang="scss">
  .cardTitle {
    display: flex;
    cursor: pointer;
  }
  .active{
    color: $theme_color;
    position: relative;
    &::before{
      content: '';
      position: absolute;
      width: 100%;
      height: 3px;
      bottom: 0;
      left: 0;
      background: $theme_color;
    }
  }
 
  .cardTabs {
    display: flex;
    padding: 0 12px;
 
    > .cardTabsItem {
      padding: 0 12px;
 
    }
 
    > .cardTabsItem:hover {
 
      color: $theme_color;
    }
  }
 
  /deep/ .ivu-card, .ivu-card-head, ._Card {
    margin-bottom: 20px;
    @include white_background_color();
  }
 
  /deep/ .ivu-card-head {
    position: relative;
    padding: 0 14px;
    height: 50px;
    line-height: 50px;
 
    &::before {
      content: '';
      width: 3px;
      height: 50%;
      top: 25%;
      background: $theme_color;
      position: absolute;
      left: 0;
    }
  }
 
  .cardExtra {
    color: $theme_color;
    cursor: pointer;
  }
 
  /deep/ .ivu-card-body {
    padding: 0 !important;
    display: none;
  }
 
</style>