twg_
11 months ago
191
5
Vue

Vue Route-Link issues

Posted 11 months ago by twg_

I'm new to Vue and after watching one of Jeffrey's videos, I figured I would give it a try. I have installed vue and vue-router and then imported them. When I compile my app.js file, it succeeds. However, when I load the localhost site, my links are not create like they should be. I see the raw <router-link to=""></router-link> in my code.

app.js

import Vue from 'vue'
import VueRouter from 'vue-router'
import {routes} from './routes'

//window.Vue = Vue;
Vue.use(VueRouter);

const router = new VueRouter({
    mode:   'history',
    routes
});

new Vue({
    el: '#app',
    router,
})

routes.js

export const routes = [
    {
        path: '/',
        components: require('../views/Vue/Home'),
        name: 'home'
    }
];

layouts/app.blade.php

@include('shared.nav')

shared/nav.blade.php

<router-link to="/">Home</router-link>

Please sign in or create an account to participate in this conversation.