初学者用vue渲染表格时遇到的问题

https://img1.mukewang.com/5ca181a600019a0308000225.jpg

这些数据都是后台传过来的


STATUS 为0表示为审核中

STATUS 为1表示为正常

STATUS 为2表示为锁定状态


但我现在不知道该如何改为对于的中文,该怎么弄呀?


<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>


素胚勾勒不出你
浏览 966回答 5
5回答

海绵宝宝撒

<th>{{item.status|statusFormat}}</th>filters: {&nbsp; &nbsp; statusFormat: function(value) {&nbsp; &nbsp; &nbsp; return value === 0 ? '审核' : value === 1 ? '正常' : '锁定'&nbsp; &nbsp; }&nbsp; }

慕妹3242003

过滤器 — Vue.js使用过滤器即可

小唯快跑啊

写一个map<tr v-for="(item,index) in infoData">&nbsp; &nbsp; <th>{{statusMap[item.status]}}</th></tr>data(){&nbsp; &nbsp; return {&nbsp; &nbsp; &nbsp; &nbsp; statusMap:{&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0:"审核中",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1:"正常",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2:"锁定"&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }}

侃侃尔雅

全局的filter,可用于所有组件{{ scope.row.paragraph | time}}Vue.filter('time',function (params) {&nbsp; &nbsp; &nbsp;params = params ? params.slice(0,[10]):params&nbsp; &nbsp; return params})
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript