Commit 19d41352395f14b133c0b7ba62a604f2f24f8d24

Authored by 梁灏
1 parent b0a9eb4e

update Card

@muei 更新了一下
Showing 2 changed files with 11 additions and 8 deletions   Show diff stats
examples/routers/card.vue
1 1 <template>
2   - <Card style="width:350px" v-bind:padding="0">
  2 + <Card style="width:350px">
3 3 <p slot="title">
4 4 <Icon type="ios-film-outline"></Icon>
5 5 经典电影
... ...
src/components/card/card.vue
... ... @@ -7,6 +7,7 @@
7 7 </template>
8 8 <script>
9 9 const prefixCls = 'ivu-card';
  10 + const defaultPadding = 16;
10 11  
11 12 export default {
12 13 props: {
... ... @@ -22,7 +23,10 @@
22 23 type: Boolean,
23 24 default: false
24 25 },
25   - padding: Number
  26 + padding: {
  27 + type: Number,
  28 + default: defaultPadding
  29 + }
26 30 },
27 31 data () {
28 32 return {
... ... @@ -51,14 +55,13 @@
51 55 return `${prefixCls}-body`;
52 56 },
53 57 bodyStyles () {
54   - let padding = this.padding;
55   - if (this.padding !== undefined) {
56   - padding += 'px';
  58 + if (this.padding !== defaultPadding) {
57 59 return {
58   - padding,
59   - };
  60 + padding: `${this.padding}px`
  61 + }
  62 + } else {
  63 + return '';
60 64 }
61   - return '';
62 65 }
63 66 },
64 67 mounted () {
... ...