Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vue.component('my-component', MyComponent)
- <outer-component
- :local-component-to-be-registered-dymanically="Foo"
- >
- created() {
- this.someMethodINeedToRegisterLocalComponent('cool-component', this.localComponentToBeRegisteredDynamically);
- },
- var vm = new Vue({
- el: '#example',
- data: {
- currentView: 'home'
- },
- components: {
- home: { /* ... */ },
- posts: { /* ... */ },
- archive: { /* ... */ }
- }
- })
- <component v-bind:is="currentView">
- <!-- component changes when vm.currentView changes! -->
- </component>
- var Home = {
- template: '<p>Welcome home!</p>'
- }
- var vm = new Vue({
- el: '#example',
- data: {
- currentView: Home
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement