Guest User

Untitled

a guest
Oct 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. <script src="../node_modules/vue/dist/vue.js"></script>
  2.  
  3. <div id="app">
  4. <example :ok="ok"></example>
  5. <button @click="ok = !ok">toggle</button>
  6. </div>
  7.  
  8. <script>
  9. const Foo = {
  10. render: h => h('div', 'foo')
  11. }
  12.  
  13. const Bar = {
  14. render: h => h('div', 'bar')
  15. }
  16.  
  17. Vue.component('example', {
  18. props: ['ok'],
  19. render: (h) {
  20. return this.ok ? h(Foo) : h(Bar)
  21. }
  22. })
  23.  
  24. new Vue({
  25. el: '#app',
  26. data: { ok: true }
  27. })
  28. </script>
Add Comment
Please, Sign In to add comment