Vue. js uses v-if v-else to find no solution, vue. jsv-if
No execution was found using v-if v-else.
I have been studying Vue recently. Because I have just started learning Vue, I will always encounter such a problem. One of the mistakes I want to make today is that when I read the official documentation of Vue, it is found that when the v-if and v-else commands are used, the corresponding content appears
Initial code:
<Div v-if = "Math. random> 0.5 ">" Math. random> 0.5 "</div> <div v-else>" Math. random <= 0.5 "</div>
Result:
"Math. random> 0.5" "Math. random <= 0.5"
Later I found that I forgot to create an instance. Every Vue application should create an instance. Therefore, the modified Code is as follows:
<Div id = "test"> <div v-if = "Math. random> 0.5 ">" Math. random> 0.5 "</div> <div v-else>" Math. random <= 0.5 "</div> <script type =" text/javascript "> new Vue ({el:" # test "}) </script>
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!