mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 03:11:15 +00:00
[improvement] Use scoped-slots in Vue 2.6+ (#2688)
This commit is contained in:
@@ -44,10 +44,10 @@ export default sfc({
|
||||
|
||||
mounted() {
|
||||
const { tabs } = this.parent;
|
||||
const index = this.parent.$slots.default.indexOf(this.$vnode);
|
||||
const index = this.parent.slots().indexOf(this.$vnode);
|
||||
tabs.splice(index === -1 ? tabs.length : index, 0, this);
|
||||
|
||||
if (this.$slots.title) {
|
||||
if (this.slots('title')) {
|
||||
this.parent.renderTitle(this.$refs.title, this.index);
|
||||
}
|
||||
},
|
||||
@@ -57,11 +57,11 @@ export default sfc({
|
||||
},
|
||||
|
||||
render(h) {
|
||||
const slots = this.$slots;
|
||||
const { slots } = this;
|
||||
return (
|
||||
<div vShow={this.selected || this.parent.animated} class={bem('pane')}>
|
||||
{this.inited ? slots.default : h()}
|
||||
{slots.title && <div ref="title">{slots.title}</div>}
|
||||
{this.inited ? slots() : h()}
|
||||
{slots('title') && <div ref="title">{slots('title')}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user