🚆 Your First Component

Build a basic home page component with routing

Install the Vue Router

Routing Docs

command line
npm install vue-router

Configure a Basic Route

file_type_js main.js
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import Home from './components/Home'

const router = new VueRouter({
  routes: [
    { path: '/', component: Home },
  ]
})

new Vue({
  router, 
  render: h => h(App),
}).$mount('#app')

Create the Home Page

App.vue
<template>
  <div class="section">
    <h2>Home.vue</h2>
  </div>
</template>

Questions? Let's chat

Open Discord