鍍金池/ 問答/HTML/ vue之for循環(huán)不同條件下渲染不同內(nèi)容

vue之for循環(huán)不同條件下渲染不同內(nèi)容

<div id="app">
<div style="width: 100%;">

<div class="data-list" v-for="(item, index) in dataList">
  <el-col :span='24' class='bd-border'>
    <el-col :span='24' class='itemtop'>
      <span>{{ index+1 }}</span>
      <span  class="bdzdjj" v-if='1024<item.WLCC<1024*1024'>KB</span>
      <span  class="bdzdjj" v-else-if='1024*1024<item.WLCC<1024*1024*1024'>MB</span>
    </el-col>
  </el-col>
</div>

</div>
</div>

var app = new Vue({
    el: '#app',
    data:{
      dataList:[{
        WLCC:1048571
      },{
        WLCC:10485762
      },{
        WLCC:12000000000000
      }],
    },
   methods:{

   }

});
。。。。。。。。。。。。。。。。。。。。。。。。。。。
不同的數(shù)據(jù)情況下,渲染顯示不同的單位,但是渲染結(jié)果卻無效,只有一個單位KB,沒有MB
回答
編輯回答
夏夕

<span class="bdzdsl" v-else-if='10241024<item.WLCC && item.WLCC<10241024*1024'>{{ item.WLCC==null?0:item.WLCC }}</span>

      <span  class="bdzdjj" v-else-if='1024*1024<item.WLCC && item.WLCC<1024*1024*1024'>MB</span>
      判斷寫的不合適,但是這么寫MB和item.WLCC只顯示item.WLCC,而不顯示MB
2018年7月27日 21:34
編輯回答
蝶戀花

圖片描述

dataList里面的數(shù)據(jù)都能符合第一條判斷,只顯示KB沒毛病

2017年10月24日 18:23
編輯回答
巴扎嘿

你確定沒有寫錯?
'1024<item.WLCC<1024*1024'

2018年2月2日 00:38