<div >
       <p v-if="OK">True的时候显示,否则不显示</p>
       <template v-if="show">
           <h1>111</h1>
           <h1>222</h1>
       </template>
    </div>

调用:
    StudyShowValue("#app05");


实现:
// v-if 指令,将根据值(True or false) 来决定是否插入p元素
function StudyShowValue(obj) {
    new Vue({
        el: obj,
        data: {
            show: true,
            OK: false
        }
    })

}

  

 if  else     v-show

 <div >

        <!--条件判断语句  后面跟一个bool值-->
        <div v-if="'1'=='2'"> if</div>
        <div v-else-if="'1'=='3'">else  if</div>
        <div v-else>else</div>

        <!--v-show 条件判断显示 语句-->
        <div v-show="'1'=='1'">v-show</div>
    </div>

//调用
  StudyIfCondition("#app08")

//实现

function StudyIfCondition(obj) {
    new Vue({
        el: obj,     
    })

}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-01-25
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
猜你喜欢
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案