element 表格中使用if语句,scope写法

Posted 丁丶丁

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了element 表格中使用if语句,scope写法相关的知识,希望对你有一定的参考价值。

<el-table v-cloak id="mybox" :row-class-name="tableRowClassName" height="100%" :data="pageDate" style="width:100%;height:100%"
:default-sort="{prop: ‘date‘, order: ‘descending‘}">
<el-table-column prop="name" fixed label="仓库名称" sortable>
</el-table-column>
<el-table-column prop="telePhone" label="电话号码">
</el-table-column>
<el-table-column prop="state" label="仓库状态" sortable>
<template slot-scope="scope">
<span>{{scope.row.state==1?‘正常‘:"关闭"}}</span>
<!-- <span v-if=‘scope.row.state==0‘>关闭</span> -->
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" sortable>
<template slot-scope="scope">
<span>{{scope.row.createTime |capitalize}}</span>
<!-- <span v-if=‘scope.row.state==0‘>关闭</span> -->
</template>
</el-table-column>
<el-table-column prop="updateTime" label="修改时间" sortable>
<template slot-scope="scope">
<span>{{scope.row.createTime|capitalize}}</span>
<!-- <span v-if=‘scope.row.state==0‘>关闭</span> -->
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" fixed width=‘300px‘>
<template slot-scope="scope">
<el-button type="primary" v-if=‘scope.row.state==1‘ @click=‘editModleShow(scope.row)‘ icon="el-icon-edit" size="small">编辑</el-button>
<el-button type="primary" v-if=‘scope.row.state==1‘ @click=‘deleteModleShow(scope.row)‘ icon="el-icon-delete" size="small">删除</el-button>
<el-button type="info" v-if=‘scope.row.state==1‘ @click=‘forbidModleShow(scope.row)‘ icon="el-icon-info" size="small">禁用</el-button>
<el-button type="primary" v-if=‘scope.row.state==0‘ plain @click=‘forbidModleShow(scope.row)‘ icon="el-icon-success" size="small">启用</el-button>
</template>
</el-table-column>
</el-table>

以上是关于element 表格中使用if语句,scope写法的主要内容,如果未能解决你的问题,请参考以下文章

vue+element表格中使用render函数(if判断处理)

关于element-ui的使用

vue+element-ui+slot-scope或原生实现可编辑表格(日历)

element表格添加序号

element表格添加查看操作

vue element ui 表格 selection-change方法使用(获取某行数据)