【发布时间】:2019-12-25 08:45:18
【问题描述】:
我只想在表格列的第一行添加一个按钮(在示例代码中标有“选项”)。有没有简单的方法来检查 v-if v-if="scope.row.index === 0" 的行索引? scope.row.index 不会在这里工作。
<el-table :data="mydata">
<!-- more columns -->
<el-table-column prop="option" label="Option">
<template slot-scope="scope">
<div v-if="scope.row.index === 0">
<el-row>
<el-col>
<el-input v-model="scope.row.option"/>
</el-col>
<el-col>
<el-button @click="">Check</el-button>
</el-col>
</el-row></div>
<div v-else>
<el-input v-model="scope.row.option" />
</div>
</template>
</el-table-column>
<!-- more columns -->
</el-table>
【问题讨论】:
标签: vue.js html-table row element-ui