Vue Breaks

by mgoetzke

HTML

<div id="app">
  
  <button @click="reset">
  Increase Num
  </button>
  
  <button @click="breakIt">
  Break It !
  </button>
  
  
  <span>
  Num: {{num}}
  </span>
  
  <progress :value="2/num"></progress>   
  
  <br><br>
  <other-component v-if="num>=1"></other-component> 
  
</div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
}

li {
  margin: 8px 0;
}

h2 {
  font-weight: bold;
  margin-bottom: 15px;
}

del {
  color: rgba(0, 0, 0, 0.3);
}

Vue

Vue.component('OtherComponent', {
	template: '<h1>some child. Should only show when Num >= 1</h1>'
})

new Vue({
  el: "#app",
  data: {
    num: 1
  },
  methods: {
  	toggle: function(todo){
    	todo.done = !todo.done
    },
    breakIt() {
    	this.num = 0
    },
    reset() {
      this.num++
    }
  }
})