开发者社区> 问答> 正文

Vue中V-if vs V-show代码有什么区别呢?

Vue中V-if vs V-show代码有什么区别呢?

展开
收起
游客r3yctwty2duzw 2022-08-11 21:47:16 394 0
1 条回答
写回答
取消 提交回答
  • 区别如下

    -if vs. v-show
    
    - -if is "real" conditional rendering because it ensures that 
    event listeners
    
    and child components inside the conditional block are properly
    destroyed and recreated during toggles.
    
    -if is also lazy: if the condition is false on initial render, 
    it will not do
    
    anything - the conditional block won't be rendered until the condition
    becomes true for the first time.
    
    2022-08-12 08:53:49
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Vue.js 在前端服务化上的探索与实践 立即下载
Vue.js在前端服务化上的实践与探索 立即下载
利用编译将 Vue 组件转成 React 组件 立即下载