April 2017
Intermediate to advanced
454 pages
12h 51m
English
On initialization, the Vue instance checks whether there is an el option. In our recipes, we usually include an el option, but this time we have a template instead:
vm = new Vue({ template: '<div>{{greetings}}</div>', data: { greetings: 'Hello World' }}).$mount()
When the Vue instance has the el option, it automatically mounts to that element (if found); in our case, the Vue instances waits for the $mount call instead. We don't provide any arguments to the function and so the component gets rendered off-document.
At this point, the only way to retrieve it in the DOM is through the $el property. The $el property is always present once the component is mounted, irrespective of whether the component was mounted manually or ...
Read now
Unlock full access