1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([[214],{544:function(t,v,s){"use strict";s.r(v);var o=s(3),e=Object(o.a)({},(function(){var t=this,v=t._self._c;return v("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[v("h1",{attrs:{id:"v-if-vs-v-show"}},[v("a",{staticClass:"header-anchor",attrs:{href:"#v-if-vs-v-show"}},[t._v("#")]),t._v(" v-if vs v-show")]),t._v(" "),v("p",[v("a",{attrs:{href:"https://cn.vuejs.org/v2/guide/conditional.html#v-if-vs-v-show",target:"_blank",rel:"noopener noreferrer"}},[t._v("API"),v("OutboundLink")],1)]),t._v(" "),v("p",[v("code",[t._v("v-if")]),t._v(" 根据渲染条件决定是否把元素渲染到DOM页面,而"),v("code",[t._v("v-show")]),t._v("不管渲染条件是什么,都会把元素渲染到DOM页面,只是简单的切换CSS的显示隐藏。\n"),t._v("\n如果需要非常频繁地切换,则使用 "),v("code",[t._v("v-show")]),t._v(" 较好;如果在运行时条件很少改变,则使用 "),v("code",[t._v("v-if")]),t._v(" 较好。")])])}),[],!1,null,null,null);v.default=e.exports}}]);
|