v-if
v-if 指令用于條件性地(dì)渲染一(yī)塊內(nèi)容。這(zhè)塊內(nèi)容隻會在指令的表達式返回真值時(shí)才被渲染。
template
<h1 v-if="awesome">Vue is awesome!</h1>
v-else
你也可(kě)以使用 v-else 為(wèi) v-if 添加一(yī)個“else 區(qū)塊”。
template
<button @click="awesome = !awesome">Toggle</button>
<h1 v-if="awesome">Vue is awesome!</h1>
<h1 v-else>Oh no
網站建設開(kāi)發|APP設計開(kāi)發|小程序建設開(kāi)發