Vue.js 元素UI,通过复选框将id传递给表列
是否有方法通过Vue.js 元素UI,通过复选框将id传递给表列,vue.js,element-ui,Vue.js,Element Ui,是否有方法通过选择类型将id传递给el表格列?我已尝试传递一个插槽,但复选框未呈现。代码如下: <el-table-column> <template slot-scope="scope" v-if="scope.row"> <div :id="`column-${scope.row.name}`">{{ `reports-${scope.row.name}` }}</div> </template> &
选择
类型将id传递给el表格列
?我已尝试传递一个插槽,但复选框未呈现。代码如下:
<el-table-column>
<template slot-scope="scope" v-if="scope.row">
<div :id="`column-${scope.row.name}`">{{ `reports-${scope.row.name}` }}</div>
</template>
</el-table-column>
<el-table-column prop="selected" align="center" type="selection" class-name="checkbox-column">
</el-table-column>
{{`reports-${scope.row.name}`}
第一列通过作用域插槽获取id。而不是
id
如果您对类
没有异议,请使用单元类名称
在您的模板中
<el-table your-attrs ... :cell-class-name="cellClassName">
在skype上打电话给我,让我们想想办法。Skype ID:syed_haroon@Syed非常感谢您抽出时间!格式化程序对我不起作用,我最终从作用域插槽捕获了行名称:),因此在我的第一列中,我没有直接返回字符串,而是将其传递给函数:
{{getRowName(scope.row.name)}
在这个函数中,我将这个名称存储到一个变量中,并作为类名传递到第二列upd:我的解决方案没有解决
methods: {
cellClassName({row, column, rowIndex, columnIndex}) {
if (columnIndex === 1) return `checkbox-${rowIndex}`;
}
}