diff --git a/examples/routers/card.vue b/examples/routers/card.vue index b62acf7..1a6e922 100644 --- a/examples/routers/card.vue +++ b/examples/routers/card.vue @@ -1,5 +1,5 @@ <template> - <Card style="width:350px" v-bind:padding="0"> + <Card style="width:350px"> <p slot="title"> <Icon type="ios-film-outline"></Icon> 经典电影 diff --git a/src/components/card/card.vue b/src/components/card/card.vue index 8d08266..152f433 100644 --- a/src/components/card/card.vue +++ b/src/components/card/card.vue @@ -7,6 +7,7 @@ </template> <script> const prefixCls = 'ivu-card'; + const defaultPadding = 16; export default { props: { @@ -22,7 +23,10 @@ type: Boolean, default: false }, - padding: Number + padding: { + type: Number, + default: defaultPadding + } }, data () { return { @@ -51,14 +55,13 @@ return `${prefixCls}-body`; }, bodyStyles () { - let padding = this.padding; - if (this.padding !== undefined) { - padding += 'px'; + if (this.padding !== defaultPadding) { return { - padding, - }; + padding: `${this.padding}px` + } + } else { + return ''; } - return ''; } }, mounted () { -- libgit2 0.21.4