App component
For our router to work, we need to declare a RouterView
 component somewhere in our page template. Otherwise, there's nowhere for the page components to render.
We'll slightly restructure our app to do this. As it is, the ListingPage
 component is the root
component of the app, as it is at the top of the component hierarchy and loads all other components that we use.
Since we want the router to switch between ListingPage
 and HomePage
 based on the URL, we need another component to be above ListingPage
 in the hierarchy and handle this work. We'll call this new root component App
:
Figure 7.2. The relationship between App, ListingPage, and HomePage
Let's create the App
 component file:
$ touch resources/assets/components/App.vue
The root instance of Vue should render this to the page when it loads, instead of ListingPage
.
resources/assets/js/app.js
:
import App from '../components/App.vue'; ... var app = new Vue({ el: '#app', render: h => h(App), router });
The following is the content...