最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue改變循環(huán)遍歷后的數(shù)據(jù)實例

 更新時間:2019年11月07日 09:41:07   作者:Eternal-memory  
今天小編就為大家分享一篇vue改變循環(huán)遍歷后的數(shù)據(jù)實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

廢話不多說了,直接上代碼吧!

<dd class="clearfix" v-for="(item,index) in tableDataList" :class="index%2 != 0 ? 'dd-bg' : ''">
  <div class="indexItem indexItem3 tal" title=""><span>{{item.status}}{{countTotal}}</span></div>
</dd>
<script type="text/ecmascript-6">
import Vue from 'vue'
import axios from 'axios'
export default {
 data(){
  return{
   tableDataList:[],//定義列表數(shù)據(jù)信息
  }
 },
 mounted(){
 //獲取列表數(shù)據(jù)信息
 axios.get('url',{
  withCredentials: true
 })
  .then((res) => {
//    console.log(res);
   let tableData = res.data.data;
   this.tableDataList = tableData.table_list;
  })
  .catch((error) => {
   console.log(error)
  })
 },
 computed:{
  //將狀態(tài)數(shù)字轉(zhuǎn)換為對應(yīng)的文字解釋
   countTotal() {
    for (let i = 0; i < this.tableDataList.length; i++) {
     if (this.tableDataList[i].status === 0) {
      this.tableDataList[i].status = '文字說明0'
     } else if (this.tableDataList[i].status === 1) {
      this.tableDataList[i].status = '文字說明1'
     } else if (this.tableDataList[i].status === 2) {
      this.tableDataList[i].status = '文字說明2'
     } else if (this.tableDataList[i].status === 3) {
      this.tableDataList[i].status = '文字說明3'
     } else if (this.tableDataList[i].status === 4) {
      this.tableDataList[i].status = '文字說明4'
     } else if (this.tableDataList[i].status === 5) {
      this.tableDataList[i].status = '文字說明5'
     }
     Vue.set(this.tableDataList,i,this.tableDataList[i])
    }
   }
 }
}
</script>

注意:Vue.set(this.tableDataList,i,this.tableDataList[i]) 這段代碼必須寫,否則數(shù)據(jù)不會更新

以上這篇vue改變循環(huán)遍歷后的數(shù)據(jù)實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

富民县| 资中县| 泸州市| 读书| 贞丰县| 句容市| 措勤县| 达孜县| 常山县| 岳西县| 盐津县| 繁昌县| 霍山县| 宁安市| 伊春市| 建平县| 栾川县| 来凤县| 外汇| 大化| 新龙县| 阜南县| 临泉县| 伊宁县| 涿州市| 高碑店市| 丘北县| 旬邑县| 金秀| 保山市| 玉龙| 沅江市| 德庆县| 汉沽区| 饶阳县| 襄汾县| 桐柏县| 华池县| 农安县| 民丰县| 七台河市|