element-ui使用请教

 <el-table :data="tableData" stripe style="width: 100%">
        <el-table-column prop="uid" label="用户ID"  />
        <el-table-column prop="nickname" label="用户名" />
        <el-table-column prop="add_time" label="注册时间" />
        <el-table-column fixed="right" label="操作" width="120">
            
            <operations ></operations>
            //想要将这个template改成组件,变成上面这张调用形式,请问要如何传递scope的值
            <!-- <template #default="scope">
                <el-button
                type="text"
                size="small"
                @click.prevent="deleteRow(scope.$index)"
                >
                删除
                </el-button>
            </template> -->
        </el-table-column>
阅读 1.5k
2 个回答

使用<template>将自定义组件包裹即可,将参数作为组件的props

<template #default="scope">
    <operations :row="scope"></operations>
</template>
<operations  #default="scope"></operations>

应该就可以了吧

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题