1、v-if/v-show的区别:
v-if操作元素的渲染;
v-show操作元素的style,控制元素的显示隐藏;
2、v-if/v-else
// v-esle必须紧接着v-if使用
<template v-if="true">
显示
</template>
<template v-else>
不显示
</template>
// v-show不支持 template语法
v-if操作元素的渲染;
v-show操作元素的style,控制元素的显示隐藏;
// v-esle必须紧接着v-if使用
<template v-if="true">
显示
</template>
<template v-else>
不显示
</template>
// v-show不支持 template语法
本文标题:三(2)、指令之 v-if/v-else/v-show ----
本文链接:https://www.haomeiwen.com/subject/ywtvvhtx.html
网友评论