This file contains hidden or 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
| function sprintf(format) { | |
| var args = Array.prototype.slice.call(arguments, 1); | |
| var i = 0; | |
| return format.replace(/%s/g, function() { | |
| return args[i++]; | |
| }); | |
| } |
This file contains hidden or 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
| <template> | |
| <div id="child-a"> | |
| <h2>Child A</h2> | |
| <pre>data {{ this.$data }}</pre> | |
| <hr/> | |
| <button @click="changeScore">Change Score</button> | |
| <span>Score: {{ score }}</span> | |
| </div> | |
| </template> |
This file contains hidden or 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
| import Vue from 'vue' | |
| import Router from 'vue-router' | |
| import ParentA from '@/components/ParentA' | |
| Vue.use(Router) | |
| export default new Router({ | |
| routes: [ | |
| { | |
| path: '/', |
This file contains hidden or 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
| <template> | |
| <div id="child-b"> | |
| <h2>Child B</h2> | |
| <pre>data {{ this.$data }}</pre> | |
| <hr/> | |
| <span> Show Score: {{ score }}</span> | |
| </div> | |
| </template> | |
| <script> |
This file contains hidden or 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
| <template> | |
| <div id="child-a"> | |
| <h2>Child A</h2> | |
| <pre>data {{ this.$data }}</pre> | |
| <hr/> | |
| <button @click="changeScore">Change Score</button> | |
| <span>Score: {{ localScore }}</span> | |
| </div> | |
| </template> |
This file contains hidden or 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
| <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> |