update Card

update Card @huixisheng
This commit is contained in:
梁灏 2017-03-03 10:46:19 +08:00
parent e6c0b158e9
commit 743d027897
2 changed files with 80 additions and 38 deletions

View file

@ -1,7 +1,7 @@
<template>
<div :class="classes">
<div :class="headClasses" v-if="showHead" ref="head"><slot name="title"></slot></div>
<div :class="extraClasses" v-if="showExtra" ref="extra"><slot name="extra"></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="bodyClasses"><slot></slot></div>
</div>
</template>
@ -51,12 +51,8 @@
}
},
mounted () {
if (this.$refs.head) {
this.showHead = this.$refs.head.innerHTML != '';
}
if (this.$refs.extra) {
this.showExtra = this.$refs.extra.innerHTML != '';
}
this.showHead = this.$slots.title !== undefined;
this.showExtra = this.$slots.extra !== undefined;
}
};
</script>