Element-Ui中的el-progress指定进度条内容

根据官网中:
Element-Ui中的el-progress指定进度条内容_第1张图片
可以看出format方法是可以控制指定文字显示的。
在这里后端给我返回的就是百分比,所以要做到在进度条里显示数量。直接贴代码:

<table style="color: white;width: 100%;height: 100%;">
      <tr>
          <th style="width:10%">产线名称</th>
          <th style="width:15%">产品型号</th>
          <th style="width:25%">工单号</th>
          <th style="width:10%">工单数量</th>
          <th style="width:40%">工单执行进度</th>
       </tr>
       <tr v-for="(list,index) in data.prdOrd">
           <td>{{list.wkln}}</td>
           <td>{{list.mtr}}</td>
           <td>{{list.cod}}</td>
           <td>{{list.planQty}}</td>
           <td>
           		<el-progress :text-inside="true" :stroke-width="26" :percentage="list.fnshQty" color="#068AC7" :format="format(list,index)"></el-progress>
           </td>
        </tr>
</table>
methods: {
	format(list, index) {
         return () => {
             return Math.round(list.planQty*(list.fnshQty/100))
    	}
    },
}

关于format函数里面放一个箭头函数,有人会觉得很怪异,刚开始我也是正常函数,正常输出,但是会报错format需要传入函数,所以才会这么写。
Element-Ui中的el-progress指定进度条内容_第2张图片

后端返回的数据:
Element-Ui中的el-progress指定进度条内容_第3张图片
最后显示的数据:
Element-Ui中的el-progress指定进度条内容_第4张图片

你可能感兴趣的:(vue.js,html,html5,node.js,javascript)