vue中局部過濾器的使用


過濾器

在開發中后台傳過來的數據是數組,在前台展示的時候需要轉化為文字 0-銷售聯系人、1-系統賬號、2-公司聯系人
所以用過濾器轉化一下

 <el-table-column prop="city" label="聯系人類型" min-width="100">
       <template slot-scope="scope">
         {{ scope.row.type | statusFormat }}
       </template>
  </el-table-column>

filters: {
      //聯系人對話框中 過濾器
      statusFormat:function(input){
        let str = "_";
        switch(input){
          case 0:
            str="銷售聯系人"
                break
          case 1:
            str="系統賬號"
                break
          case 2:
            str="公司聯系人"
                break
        }
        return str
      }
    }

展示出來的狀態為:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM