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?

为情所困为情所困2556 days ago760

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