Skip to content

Instantly share code, notes, and snippets.

@lamnd
Last active June 6, 2019 08:43
Show Gist options
  • Select an option

  • Save lamnd/742bd655e680261c790ce62f943c79c3 to your computer and use it in GitHub Desktop.

Select an option

Save lamnd/742bd655e680261c790ce62f943c79c3 to your computer and use it in GitHub Desktop.
Parent A
<template>
<div id="parent-a">
<h2>Parent A</h2>
<pre>data {{ this.$data }}</pre>
<button @click="reRender">Rerender Parent</button>
<hr/>
<child-a :score="score" @updateScore="updateScore"/>
<child-b :score="score"/>
</div>
</template>
<script>
import ChildA from './ChildA'
import ChildB from './ChildB'
export default {
name: 'Parent A',
data () {
return {
score: 100
}
},
methods : {
updateScore(newScore) {
this.score = newScore;
},
reRender() {
this.$forceUpdate()
},
},
components: {
ChildA, ChildB
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment