I am using Laravel5.4 and vuejs 2. I am not getting response but some errors in console .Please help me to solve this errors. It gives error like [Vue warn]: Error in mounted hook and TypeError: Cannot read property 'get . I have mention error message below.I have install package using npm install
and npm vue-resource
Friend.vue
<template>
<div class="container">
<div class="row">
<div class="panel-body">
I'm an example component!
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
this.$http.get('/check_relationship_status/' + this.profile_user_id )
.then( (resp) => {
console.log(resp)
})
},
props: ['profile_user_id'],
}
</script>
profile.blade.php
@if(Auth::id() !== $user->id)
<div class="panel panel-default">
<div class="panel-body">
<friend :profile_user_id=""></friend>
</div>
</div>
@endif
app.js
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('friend', require('./components/Friend.vue'));
const app = new Vue({
el: '#app'
});
and error message is:
app.js:16086 TypeError: Cannot read property 'get' of undefined
at VueComponent.mounted (app.js:12074)
at callHook (app.js:16859)
at Object.insert (app.js:17668)
at invokeInsertHook (app.js:19468)
at Vue$3.patch [as __patch__] (app.js:19632)
at Vue$3.Vue._update (app.js:16626)
at Vue$3.updateComponent (app.js:16736)
at Watcher.get (app.js:17051)
at new Watcher (app.js:17034)
at mountComponent (app.js:16746)
via Ranjeet Karki