Merge pull request #429 from muei/2.0
style(card): feat padding switch prop
This commit is contained in:
commit
b0a9eb4e2c
2 changed files with 14 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<Card style="width:350px">
|
<Card style="width:350px" v-bind:padding="0">
|
||||||
<p slot="title">
|
<p slot="title">
|
||||||
<Icon type="ios-film-outline"></Icon>
|
<Icon type="ios-film-outline"></Icon>
|
||||||
经典电影
|
经典电影
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div :class="classes">
|
<div :class="classes">
|
||||||
<div :class="headClasses" v-if="showHead"><slot name="title"></slot></div>
|
<div :class="headClasses" v-if="showHead"><slot name="title"></slot></div>
|
||||||
<div :class="extraClasses" v-if="showExtra"><slot name="extra"></slot></div>
|
<div :class="extraClasses" v-if="showExtra"><slot name="extra"></slot></div>
|
||||||
<div :class="bodyClasses"><slot></slot></div>
|
<div :class="bodyClasses" :style="bodyStyles"><slot></slot></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -21,7 +21,8 @@
|
||||||
shadow: {
|
shadow: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
},
|
||||||
|
padding: Number
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -48,6 +49,16 @@
|
||||||
},
|
},
|
||||||
bodyClasses () {
|
bodyClasses () {
|
||||||
return `${prefixCls}-body`;
|
return `${prefixCls}-body`;
|
||||||
|
},
|
||||||
|
bodyStyles () {
|
||||||
|
let padding = this.padding;
|
||||||
|
if (this.padding !== undefined) {
|
||||||
|
padding += 'px';
|
||||||
|
return {
|
||||||
|
padding,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue