add Card component
add Card component
This commit is contained in:
parent
49306c7a7f
commit
15bae14479
10 changed files with 163 additions and 21 deletions
58
components/card/card.vue
Normal file
58
components/card/card.vue
Normal file
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<div :class="classes">
|
||||
<div :class="headClasses" v-if="showHead" v-el:head><slot name="title"></slot></div>
|
||||
<div :class="extraClasses" v-if="showExtra" v-el:extra><slot name="extra"></slot></div>
|
||||
<div :class="bodyClasses"><slot></slot></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
const prefixCls = 'ivu-card';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
bordered: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
disHover: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
shadow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
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`;
|
||||
}
|
||||
},
|
||||
compiled () {
|
||||
this.showHead = this.$els.head.innerHTML != '';
|
||||
this.showExtra = this.$els.extra.innerHTML != '';
|
||||
}
|
||||
}
|
||||
</script>
|
2
components/card/index.js
Normal file
2
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