1. vue中管道操作符(|)的使用

8.1 管道符| 使用技巧
//自定义过滤器,通过管道操作符|改变列表单元格的值
<el-table-column
    prop="status"
    label="状态"
    align="center"
    width="80">
    <template slot-scope="scope">
        {{scope.row.status | getStatus}}
    </template>
</el-table-column>

<script>    
    export default {
        data() {
            return {......}                     
        },
        filters: {
            getStatus: function(num){ 
                let str = ''
                if (num == 1){
                    str = '启用'
                } else {
                    str = '禁用'
                }
                return str;
            }
        },
        methods: {
            list(){......},                                       
        },
    }
</script>
View Code

相关文章:

  • 2022-12-23
  • 2021-07-20
  • 2022-01-05
  • 2021-12-02
  • 2021-06-26
  • 2022-12-23
  • 2021-11-27
  • 2022-02-08
猜你喜欢
  • 2021-05-26
  • 2021-12-20
  • 2021-07-24
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
相关资源
相似解决方案