update the master branch to the latest
This commit is contained in:
parent
67d534df27
commit
23a0ba9831
611 changed files with 122648 additions and 0 deletions
86
src/components/card/card.vue
Normal file
86
src/components/card/card.vue
Normal file
|
@ -0,0 +1,86 @@
|
|||
<template>
|
||||
<div :class="classes">
|
||||
<div :class="headClasses" v-if="showHead"><slot name="title">
|
||||
<p v-if="title">
|
||||
<Icon v-if="icon" :type="icon"></Icon>
|
||||
<span>{{title}}</span>
|
||||
</p>
|
||||
</slot></div>
|
||||
<div :class="extraClasses" v-if="showExtra"><slot name="extra"></slot></div>
|
||||
<div :class="bodyClasses" :style="bodyStyles"><slot></slot></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
const prefixCls = 'ivu-card';
|
||||
const defaultPadding = 16;
|
||||
import Icon from '../icon/icon.vue';
|
||||
|
||||
export default {
|
||||
name: 'Card',
|
||||
components: { Icon },
|
||||
props: {
|
||||
bordered: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
disHover: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
shadow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
padding: {
|
||||
type: Number,
|
||||
default: defaultPadding
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showHead: true,
|
||||
showExtra: true
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
classes () {
|
||||
return [
|
||||
`${prefixCls}`,
|
||||
{
|
||||
[`${prefixCls}-bordered`]: this.bordered && !this.shadow,
|
||||
[`${prefixCls}-dis-hover`]: this.disHover || this.shadow,
|
||||
[`${prefixCls}-shadow`]: this.shadow
|
||||
}
|
||||
];
|
||||
},
|
||||
headClasses () {
|
||||
return `${prefixCls}-head`;
|
||||
},
|
||||
extraClasses () {
|
||||
return `${prefixCls}-extra`;
|
||||
},
|
||||
bodyClasses () {
|
||||
return `${prefixCls}-body`;
|
||||
},
|
||||
bodyStyles () {
|
||||
if (this.padding !== defaultPadding) {
|
||||
return {
|
||||
padding: `${this.padding}px`
|
||||
};
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.showHead = this.title || this.$slots.title !== undefined;
|
||||
this.showExtra = this.$slots.extra !== undefined;
|
||||
}
|
||||
};
|
||||
</script>
|
2
src/components/card/index.js
Normal file
2
src/components/card/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
import Card from './card.vue';
|
||||
export default Card;
|
Loading…
Add table
Add a link
Reference in a new issue