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>

1646620853(1).png

阅读 2.8k
1 个回答
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>
    )
  }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题