Created
September 27, 2019 07:44
-
-
Save acacha/a47878f65a3239ae71faa14ca946e473 to your computer and use it in GitHub Desktop.
Force update example (Antipattern as 99% of cases is not necessary to rerender manually vue does the job)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.component('ParentA',{ | |
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"/> | |
<child-b/> | |
</div>`, | |
data() { | |
return { | |
score: 100 | |
} | |
}, | |
methods: { | |
reRender() { | |
this.$forceUpdate(); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment