Blame view

node_modules/mpvue-zanui/src/components/zan/capsule.vue 1.05 KB
ce4c83ff   wxy   初始提交
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
  <template>
    <div @click="doClick" class="zan-capsule" :class="'zan-capsule--' + type">
      <block v-if="color">
        <div class="zan-capsule__left" :style="computedClassStr">{{ leftText }}</div>
        <div class="zan-capsule__right" :style="getObject">{{ rightText }}</div>
      </block>
      <block v-else>
        <div class="zan-capsule__left">{{ leftText }}</div>
        <div class="zan-capsule__right">{{ rightText }}</div>
      </block>
    </div>
  </template>
  
  <script>
      export default {
        props: {
          type: String,
          color: String,
          leftText: String,
          rightText: String,
          onclick: Function
        },
        computed: {
          computedClassStr: function () {
            return 'background: ' + this.color + '; border-color: ' + this.color
          },
          getObject: function () {
            return 'color: ' + this.color + '; border-color: ' + this.color
          }
        },
        methods: {
          doClick () {
            const a = this.onclick || function () {}
            a()
          }
        }
      }
  </script>
  
  <style scoped>
  
  </style>