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

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

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

廢話不多說(shuō)了,直接上代碼吧!

<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)換為對(duì)應(yīng)的文字解釋
   countTotal() {
    for (let i = 0; i < this.tableDataList.length; i++) {
     if (this.tableDataList[i].status === 0) {
      this.tableDataList[i].status = '文字說(shuō)明0'
     } else if (this.tableDataList[i].status === 1) {
      this.tableDataList[i].status = '文字說(shuō)明1'
     } else if (this.tableDataList[i].status === 2) {
      this.tableDataList[i].status = '文字說(shuō)明2'
     } else if (this.tableDataList[i].status === 3) {
      this.tableDataList[i].status = '文字說(shuō)明3'
     } else if (this.tableDataList[i].status === 4) {
      this.tableDataList[i].status = '文字說(shuō)明4'
     } else if (this.tableDataList[i].status === 5) {
      this.tableDataList[i].status = '文字說(shuō)明5'
     }
     Vue.set(this.tableDataList,i,this.tableDataList[i])
    }
   }
 }
}
</script>

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

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

相關(guān)文章

最新評(píng)論

子洲县| 鹤峰县| 扶余县| 汨罗市| 静安区| 邵武市| 区。| 伊通| 清涧县| 闻喜县| 朝阳区| 伊宁市| 莒南县| 平武县| 剑川县| 颍上县| 正蓝旗| 瓦房店市| 忻州市| 莒南县| 丹阳市| 葫芦岛市| 武穴市| 黄冈市| 石狮市| 定州市| 称多县| 汉源县| 合江县| 肥城市| 新竹市| 梧州市| 吴江市| 花垣县| 大兴区| 当雄县| 郯城县| 永仁县| 靖江市| 大竹县| 泰州市|