vue+element在el-table-column中写v-if

如图:在列表中显示物品状态是否归还,若已归还可以点击查看归还详情

<el-table-column prop="sfgh" label="是否归还" align="center">
                <template scope="scope">
                    <p v-if="scope.row.sfgh=='0'">
                        <el-button  href="javascript:void(0)" @click="getWzghInfo(scope.$index, scope.row)">已归还</el-button>
                    </p>
                    <p v-if="scope.row.sfgh=='1'">未归还</p>
                    <p v-if="scope.row.sfgh=='2'">未还清</p>
                </template>
            </el-table-column>

 <template scope="scope">:可以通过scope.row.键名,获取所在行的某一列的数据

效果如图:

猜你喜欢

转载自www.cnblogs.com/wl1202/p/12661572.html