Creating an instance of Vue
The Vue library we added in the last video provides a global Vue object, which includes several APIs.
We can create a new Vue app by calling the
So let's get rid of this
console.log and put:
In order to attach this Vue app to the page, we can chain on the
We now need to pass a query selector to the
mount method to tell the Vue app where in the page we want it to attach.
Looking at our HTML file, you'll see that I've put an element with id app inside the
body tag. This is the part of the page we want Vue to modify.
To mount Vue on the element we just saw, we'll reference it with CSS selector
With that, we've now created a Vue app and attached it to the page. In the next video, we'll see how we can use Vue now to manipulate the page.
Click to load comments...