Answer the question
In order to leave comments, you need to log in
How to properly load Vue JS components?
Hello.
Started doing SPA.
In general, under the Laravel 5.5 capt,
I just can’t figure out how to load the component by clicking on the route.
Now I have this structure:
<div class="container">
<div id="root"></div>
</div>
require('./bootstrap');
window.Vue = require('vue');
import Vue from 'vue'
import App from './App.vue'
import router from './router'
const app = new Vue({
el: '#root',
components: { App },
template: '<app></app>',
router
})
<template v-for="item in items"><code lang="javascript">
</code>
<div id="root">
<router-link :to="{ path: '/test'}" replace>TEST</router-link>
</div>
</template>
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const router = new VueRouter({
routes: [
{path: '/test', component: require('./views/Main.vue')}
]
})
export default router
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question