[Vuejs]-Unknown custom element Vue with Laravel

0👍

Try with this, since i cannot see where are you mounting your “app”

import LoginComponent from './components/LoginComponent';

const app = new Vue({
    el: '#app',
    render: h => h(LoginComponent)
});

I usually do something like:

import LoginApp from './components/LoginApp.vue';

const app = new Vue({
    el: '#app',
    render: h => h(LoginApp)
});

Then in LoginApp.vue i would do something like this:

<template>
   <div>
      <login-component></login-component>
   </div>
</template>

Vue.component('LoginComponent', require('.components/LoginComponent'));
<script>
    export default {
        mounted() {
            console.log('Login Component mounted.');
        },
    }
</script>

Leave a comment