Blame view

node_modules/mpvue-zanui/src/pages/zan_capsule/index.vue 1.23 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  <template>
    <div class="container">
  
      <div class="doc-title zan-hairline--bottom">CAPSULE</div>
  
      <div class="zan-panel-title">基本用法</div>
      <div class="zan-panel">
        <div class="zan-cell zan-cell--last-child">
          <capsule v-bind="{leftText:'1折', rightText:'限购一份'}" ></capsule>
          <capsule v-bind="{leftText:'1折', rightText:'限购一份', type:'danger'}" ></capsule>
        </div>
      </div>
  
      <div class="zan-panel-title">自定义颜色</div>
      <div  class="zan-panel">
        <div class="zan-cell zan-cell--last-child">
          <capsule v-bind="data" ></capsule>
        </div>
      </div>
    </div>
  </template>
  
  <script>
    import capsule from '../../components/zan/capsule'
  
    export default {
      components: {
        capsule
      },
      data () {
        return {
          data: {
            leftText: '1折',
            rightText: '限购一份',
            color: '#38f',
            onclick: null
          }
        }
      },
      mounted () {
        this.data.onclick = this.change
      },
      methods: {
        change () {
          this.data.color = Math.random() > 0.5 ? '#7f71ff' : '#ff6c2e'
        }
      }
    }
  </script>
  <style >
  </style>
  <style  scoped>
    .zan-capsule + .zan-capsule {
      margin-left: 10px;
    }
  </style>