vue instruction bound v-if logical structure

<!-- if判断 -->
<div id="app2">
    <p  v-if="seen"> <!-- 给p标签绑定指令 -->
        显示内容
    </p>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app2 = new Vue({
        el: "#app2",
        data: {
            seen: true
        }
    });
</script>

Enter the console app2.seenwill get value app2 seen in the data, but can also be assigned to false, so will the plabel be removed from the document, and then if it is assigned true, it will re-display, and the document will appear pin the label

Will not show

Redisplay

Guess you like

Origin www.cnblogs.com/zxcv123/p/12004006.html