@VaniXac
17 лет

Роутинг одностраничного приложения VueJS?

Выдает ошибку.
В чем причина?

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>


И сама ошибка:
[Vue warn]: Failed to mount component: template or render function not defined.

found in

--->
  • Вопрос задан
  • 177 просмотров
Решения вопроса 1
@lmilligan
<template>
    <cards></cards>
</template>

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

    export default {
        name: "index",
        components: {
           Cards
        }
    }
</script>
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@akavato
frontend dev
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы