如实现根据不同数据展示不同状态,实现是通过if判断是否显示。
 主要是框选部分的代码,tableDate是我绑定的数据,reason是我通过这个数据来判断。
 
 代码:
<el-table-column
                prop="reason"
                label="是否实现"
                align="center"
                width="100"
            >
                <template slot-scope="scope">
                    <el-button
                        type="success"
                        icon="el-icon-check"
                        circle
                        size="small"
                        v-if="tableData[scope.$index].reason == 1"
                    >
                    </el-button>
                    <el-button
                        type="danger"
                        icon="el-icon-close"
                        circle
                        size="small"
                        v-if="tableData[scope.$index].reason == 0"
                    >
                    </el-button>
                </template>
            </el-table-column>
通过if判断
v-if="tableData[scope.$index].reason == 1"

 京公网安备 11010502036488号
京公网安备 11010502036488号