Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Vue.component('my-component', MyComponent)
  2.  
  3. <outer-component
  4. :local-component-to-be-registered-dymanically="Foo"
  5. >
  6.  
  7. created() {
  8. this.someMethodINeedToRegisterLocalComponent('cool-component', this.localComponentToBeRegisteredDynamically);
  9. },
  10.  
  11. var vm = new Vue({
  12. el: '#example',
  13. data: {
  14. currentView: 'home'
  15. },
  16. components: {
  17. home: { /* ... */ },
  18. posts: { /* ... */ },
  19. archive: { /* ... */ }
  20. }
  21. })
  22. <component v-bind:is="currentView">
  23. <!-- component changes when vm.currentView changes! -->
  24. </component>
  25.  
  26. var Home = {
  27. template: '<p>Welcome home!</p>'
  28. }
  29. var vm = new Vue({
  30. el: '#example',
  31. data: {
  32. currentView: Home
  33. }
  34. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement