[bugfix] Tab: title slot render (#1212)

This commit is contained in:
neverland
2018-05-31 17:58:59 +08:00
committed by GitHub
parent 3fa49cdd3e
commit 9b01710556
4 changed files with 82 additions and 38 deletions
+9 -7
View File
@@ -19,8 +19,7 @@
}"
@click="onClick(index)"
>
<van-node v-if="tab.$slots.title" :node="tab.$slots.title" />
<span class="van-ellipsis" v-else>{{ tab.title }}</span>
<span class="van-ellipsis" ref="title">{{ tab.title }}</span>
</div>
</div>
</div>
@@ -34,7 +33,6 @@
import create from '../utils/create';
import { raf } from '../utils/raf';
import { on, off } from '../utils/event';
import VanNode from '../utils/node';
import scrollUtils from '../utils/scroll';
import Touch from '../mixins/touch';
@@ -43,10 +41,6 @@ export default create({
mixins: [Touch],
components: {
VanNode
},
model: {
prop: 'active'
},
@@ -261,6 +255,14 @@ export default create({
}
};
animate();
},
// render title slot of child tab
renderTitle(el, index) {
this.$nextTick(() => {
const title = this.$refs.title[index];
title.parentNode.replaceChild(el, title);
});
}
}
});