V
V
Vanik Khachatryan2018-03-28 02:52:22
Vue.js
Vanik Khachatryan, 2018-03-28 02:52:22

VueJS Single Page Application Routing?

Gives an error message.
What is the reason?
app.js

let Vue = require('vue');
import VueRouter from 'vue-router'

Vue.use(VueRouter);

import Index from './pages/Index.vue';

const routes = [
    { path: '/', component:  Index }
];

const router = new VueRouter({routes});

const app = new Vue({
    router
}).$mount('#app-content');

Index.js
<template>
    <cards></cards>
</template>

<script>
    import Cards from '../components/Cards.vue';

    export default {
        name: "index",
        components: Cards
    }
</script>

And the error itself:
[Vue warn]: Failed to mount component: template or render function not defined.
found in
--->

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lmilligan, 2018-03-28
@VaniXac

<template>
    <cards></cards>
</template>

<script>
    import Cards from '../components/Cards.vue';

    export default {
        name: "index",
        components: {
           Cards
        }
    }
</script>

A
akavato, 2018-03-28
@akavato

Local Components

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question