丢雷老某 2020-11-12 11:47 采纳率: 0%
浏览 3686

antd vue是如何实现slot-scope传多参的?

antd vue表格使用作用域插槽显示数据

<template slot="customRender"slot-scope="text, record, index, column">

获取文本数据使用text,当前行数据为record,索引index,而官网使用作用域插槽时只指定一个参数

<templatev-slot:default="slotProps"> {{ slotProps.user.firstName }} </template>

想了解一下,antd vue是如何实现传递多个参数的。

  • 写回答

5条回答 默认 最新

  • savage1204 2021-02-05 11:16
    关注

    这个需要手写渲染函数,template 的 v-bind只支持对象传参,传多参数参考如下:

    this.$scopeSlot.customRender(text, record, index, column)

    接收参数:

    <template slot="customRender" slot-scope="text, record, index, column">
        {{text}}
        {{record}}
        {{index}}
        {{column}}
    </template>
    评论

报告相同问题?