vue在render中写jsx slot-scope内的值如何写?
原本antd是这样写的,放到在render中应该怎么写呢
<a-list item-layout="horizontal" :data-source="data"> <a-list-item slot="renderItem" slot-scope="item, index">
<a slot="title" href="https://www.antdv.com/">{{ item.title }}</a>
</a-list-item-meta>
</a-list-item>
</a-list>
回答:
render() { // 传递所有属性
// {...{
// props: this.$attrs,
// }}
return (
<a-form-model ref="formRef" class="z-form" layout={this.layout} labelCol={this.labelCol}
wrapperCol={this.wrapperCol || { span: 24 - this.labelCol.span }}
{...{
props: { ...this.$attrs, model: this.model },
}} >
<a-row type="flex" justify="start">
{
this.$slots.default.map(el => {
el.data.attrs.form = this.model
return <a-col style="margin-top:10px;" span={el.data.attrs.span || this.span}>{el}</a-col>
})
}
{
this.type === 'query' ?
<a-col span={this.span} style="margin-top:14px;padding-left:20px;" >
<a-button class="ant-btn-primary-dark" type="primary" {
...{
on: {
click: this.onSubmit
}
}
}>查询</a-button>
<a-button
type="primary"
class="ml8" {
...{
on: {
click: this.resetForm
}
}
}>重置</a-button>
</a-col>
: null
}
</a-row>
</a-form-model>
)
}
以上是 vue在render中写jsx slot-scope内的值如何写? 的全部内容, 来源链接: utcz.com/p/937223.html