Vue

by Phil Brown

HTML

<div id="app">
  <foo :foo="obj.foo"></foo>
</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('foo', {
	template: `<div>{{ foo }}</div>`,
  props: ['foo'],
  mounted () {
  	console.log('mounted child', this.foo)
  },
  beforeUpdate () {
  	console.log('beforeUpdate', this.foo)
  }
})
new Vue({
  el: "#app",
  data: {
  	obj: {}
  },
  created () {
  	setTimeout(() => {
    	this.obj = { foo: 'bar' }
    }, 2000)
  },
  mounted () {
  	console.log('mounted parent')
  }
})