I am trying to make a laravel application with vue js. I am new to vue, so learning a lot yet. Now my application has two interfaces. One for admin panel and the other for normal users. Now when I am including the vue components in admin panel's blade under a div with id "app" as defined in app.js, the components are working fine. But when I am trying to include some components in the normal use's interface under a div with id "app2" with defining 'app2' in app.js just like 'app'. But it is not working. How can I make the components work in the user interface's blade?
Here is my profile blade. where I am trying to show the component
@extends('layouts.main')
@section('body_content')
<div id='app2'>
<profile-component></profile-component>
</div>
@endsection
Here is my modification in app.js
Vue.component('profile-component', require('./components/Profile.vue'));
const app2 = new Vue({
el: '#app2',
});
and finally here is the profile component
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card card-default">
<h1>Profile Page</h1>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
app2toapp- Niklesh Rautconst app2 = new Vue({el: 'app2'})- Presmelito