-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[vue] v-show和v-if有什么区别?使用场景分别是什么? #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
终于有一题是我会的了 |
v-show在频繁切换的时候使用 |
区别:v-if 不渲染 DOM,v-show 会渲染 DOM v-show 使用场景:
|
v-show 是css的display显示和隐藏 v-show 使用场景: |
为什么我点的是mvvm mvc mvp模式的理解进到这个页面 |
mvc和v-if这俩题目的链接放反了。 |
v-if 有dom操作,适合一锤子买卖, |
v-if下面还可以写v-else-if和v-else,而v-show不行 |
v-shou 只是隐藏了当前DOM,但是还是会照常渲染。 |
v-show会触发生命周期吗?v-if呢?为什么? |
v-show:false,也即css设置为display: none。在页面中不占据位置,但是DOM依然存在,发生回流 |
v-show底层原理是 display:none v-show在组件需要频繁切换时使用 |
v-if是通过删除或添加dom节点的方式对元素进行操作;而v-show是通过设置css样式来控制的元素显示隐藏; v-if应用在操作不频繁的元素上;v-show应用在需要频繁切换显示隐藏的元素上 |
[vue] v-show和v-if有什么区别?使用场景分别是什么?
The text was updated successfully, but these errors were encountered: