search

Home  >  Q&A  >  body text

javascript - How to deal with two v-ifs in vue.js?

 <span><i class="fz14 oStatus" v-if="site.order_status === 1">+</i>{{site.order_amount}}</span><br>        
       <span><i class="fz14 oStatus" v-if="site.order_status === 2">-</i>{{site.order_amount}}</span><br>


Why does it appear twice? I only want data with or -, what should I do?

为情所困为情所困2706 days ago875

reply all(2)I'll reply

  • 滿天的星座

    滿天的星座2017-07-05 10:52:33

    Your v-if was added in the wrong position, it should be added on <span>.

    reply
    0
  • typecho

    typecho2017-07-05 10:52:33

    It would be better to use if-else

    reply
    0
  • Cancelreply