Problems encountered by beginners in rendering tables with vue

clipboard.png

these data are all sent from the background

STATUS 0 indicates auditing
STATUS 1 indicates normal
STATUS 2 indicates locked status

but now I don"t know how to change it to Chinese, how to do it?

<tr v-for="(item,index) in infoData">
    <td>{{index+1}}</td>
    <td>{{item.name}}</td>
    <td>{{item.email}}</td>
    <td>{{item.roleName}}</td>
    <th>{{item.status}}</th>
</tr>

Mar.09,2021

ide/filters.html" rel=" nofollow noreferrer "> filter-Vue.js

use a filter


write a map

<tr v-for="(item,index) in infoData">
    <th>{{statusMap[item.status]}}</th>
</tr>

data(){
    return {
        statusMap:{
            0:"",
            1:"",
            2:""
        }
    }
}

<th>{{item.status|statusFormat}}</th>
filters: {
    statusFormat: function(value) {
      return value === 0 ? '' : value === 1 ? '' : ''
    }
  }

use filters: ide/filters.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.


Global filter, is available for all components

{{ scope.row.paragraph | time}}

Vue.filter('time',function (params) {
     params = params ? params.slice(0,[10]):params
    return params
})
Menu