feat: migrate Tabbar component

This commit is contained in:
chenjiahan
2020-07-26 13:12:21 +08:00
parent 75421a4727
commit 7fda2659f5
4 changed files with 25 additions and 19 deletions
+7 -5
View File
@@ -24,6 +24,8 @@ export default createComponent({
iconPrefix: String,
},
emits: ['click'],
data() {
return {
active: false,
@@ -51,10 +53,8 @@ export default createComponent({
},
genIcon(active) {
const slot = this.slots('icon', { active });
if (slot) {
return slot;
if (this.$slots.icon) {
return this.$slots.icon({ active });
}
if (this.icon) {
@@ -76,7 +76,9 @@ export default createComponent({
info={isDef(this.badge) ? this.badge : this.info}
/>
</div>
<div class={bem('text')}>{this.slots('default', { active })}</div>
<div class={bem('text')}>
{this.$slots.default ? this.$slots.default({ active }) : null}
</div>
</div>
);
},