Commit fb8a7b3f559e72f0bc7ffa03bb5a7513813603f0

Authored by young
1 parent 57737d74

style(card): feat padding switch prop

Showing 1 changed file with 13 additions and 1 deletions   Show diff stats
src/components/card/card.vue
... ... @@ -2,7 +2,7 @@
2 2 <div :class="classes">
3 3 <div :class="headClasses" v-if="showHead"><slot name="title"></slot></div>
4 4 <div :class="extraClasses" v-if="showExtra"><slot name="extra"></slot></div>
5   - <div :class="bodyClasses"><slot></slot></div>
  5 + <div :class="bodyClasses" :style="bodyStyles"><slot></slot></div>
6 6 </div>
7 7 </template>
8 8 <script>
... ... @@ -21,6 +21,10 @@
21 21 shadow: {
22 22 type: Boolean,
23 23 default: false
  24 + },
  25 + padding: {
  26 + type: Boolean,
  27 + default: true
24 28 }
25 29 },
26 30 data () {
... ... @@ -48,6 +52,14 @@
48 52 },
49 53 bodyClasses () {
50 54 return `${prefixCls}-body`;
  55 + },
  56 + bodyStyles () {
  57 + if (!this.padding) {
  58 + return {
  59 + padding: 0
  60 + };
  61 + }
  62 + return '';
51 63 }
52 64 },
53 65 mounted () {
... ...