In this section, we'll look at the file structure of our Vue project that we have set up using Vue-cli. Our quickstart-vue
folder structure is as follows:
Let's first examine the contents of the main.js
file:
import Vue from 'vue' import App from './App.vue' Vue.config.productionTip = false new Vue({ render: h => h(App) }).$mount('#app')
We begin by importing Vue
from the vue
folder. This vue
folder is located in your node_modules
folder.
Next, we import App
from App.vue
.
As we have already learned, new Vue
creates a Vue instance, and we then pass it the options object.
Inside the options object, we are only setting the render
property. As we can see, the render
property's value is an arrow function:
h => h(App)
The arrow function accepts, as its parameter, the App
component that we imported on line two of the main.js
file.
As you can probably tell, the previous function is written in ES6. Transpiled to ES5, it would look like this:
function(h...