Answer the question
In order to leave comments, you need to log in
Why don't v-if and v-else blocks hide an object depending on the value?
Hello. I started learning js, html, now I started learning vue.
( I connect vue.js like this:
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="vueElement">
<button v-on:onclick="status = !status">Скрыть / Показать</button>
<p v-if="status">Status is true!</p>
<p v-else>Status is false!</p>
</div>
new Vue ({
el: "vueElement",
data: {
status: true
}
});
Answer the question
In order to leave comments, you need to log in
el: "vueElement",
replace with el: "#vueElement",
<button v-on:onclick="status = !status">
replace with<button v-on:click="status = !status">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question