feat: ✨ jsx 重写 d2-container 的 render
This commit is contained in:
parent
babfb3e4b4
commit
f64b267ee9
|
|
@ -38,22 +38,22 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render (h) {
|
render (h) {
|
||||||
const slots = [this.$slots.default]
|
const slots = [
|
||||||
if (this.$slots.header) slots.push(h('template', { slot: 'header' }, [this.$slots.header]))
|
this.$slots.default,
|
||||||
if (this.$slots.footer) slots.push(h('template', { slot: 'footer' }, [this.$slots.footer]))
|
this.$slots.header ? <template slot="header">{ this.$slots.header }</template> : null,
|
||||||
return h('div', {
|
this.$slots.footer ? <template slot="footer">{ this.$slots.footer }</template> : null
|
||||||
ref: 'container',
|
]
|
||||||
class: 'container-component'
|
return <div
|
||||||
}, [
|
ref="container"
|
||||||
h(this.component, {
|
class="container-component">
|
||||||
ref: 'component',
|
<this.component
|
||||||
props: this.$attrs,
|
ref="component"
|
||||||
on: {
|
{ ...{ attrs: this.$attrs } }
|
||||||
scroll: e => this.$emit('scroll', e)
|
onScroll={ e => this.$emit('scroll', e) }>
|
||||||
}
|
{ slots }
|
||||||
}, slots),
|
</this.component>
|
||||||
h(d2Source)
|
<d2Source/>
|
||||||
])
|
</div>
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 返回顶部
|
// 返回顶部
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue