Vue renders v-if=true. But if I change bool true to false,
vue doesn't re-render to v-else div.
How should it be? Is there any way to re-render?
Here is my code:
<template>
<div v-if="bool">
true
</div>
<div v-else>
false // if button pressed, i should be shown!!!!
</div>
<button :click='onClickEvent()'>click!!!!!!</button>
</template>
<script>
export default {
data: function () {
return {
bool: true
};
},
created() {
},
mounted(){
}
methods: {
onClickEvent: function(){
this.bool= false
}
}
};
</script>
I tried everything I could think of.