美文网首页
element UI中表格的数据需要做判断

element UI中表格的数据需要做判断

作者: 木子川页心 | 来源:发表于2019-05-21 13:57 被阅读0次

从数据库中拿到数据,

如拿到0,1。

想变成男,女放入表单中

html文件

<el-table
                  ref="multipleTable"
                  :data="bsBuses"
                  tooltip-effect="dark"
                  style="width: 100%">
              
              <el-table-column
                      prop="sex"
                      label="性别"
                      :formatter="formatSex">
              </el-table-column>
          </el-table>

Vue文件

methods:{
formatSex: function (row, column, cellValue) {
            if (cellValue === "1"){
                return '女';
            }else if (cellValue === "0"){
                return '男';
            }
        }

}

相关文章

网友评论

      本文标题:element UI中表格的数据需要做判断

      本文链接:https://www.haomeiwen.com/subject/nkxjzqtx.html