Javascript 带有laravel的Vue js警告消息
我使用的是Laravel5.4和vuejs 2。我没有得到响应,但控制台中有一些错误。请帮助我解决这些错误。它给出了类似于 [Vue warn]:挂载的挂钩和类型错误:无法读取属性“get”。 我在下面提到了错误消息。我使用Javascript 带有laravel的Vue js警告消息,javascript,php,laravel,vuejs2,laravel-5.4,Javascript,Php,Laravel,Vuejs2,Laravel 5.4,我使用的是Laravel5.4和vuejs 2。我没有得到响应,但控制台中有一些错误。请帮助我解决这些错误。它给出了类似于 [Vue warn]:挂载的挂钩和类型错误:无法读取属性“get”。 我在下面提到了错误消息。我使用npm install和npm vue资源安装了软件包 Friend.vue <template> <div class="container"> <div class="row"> <
npm install
和npm vue资源安装了软件包
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>
错误消息是:
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)
在代码中包含vue资源$http
在中,此
不会exist@TamilSelvanC非常感谢,您解决了我的问题:包括vue-resource@MarcoAur埃利奥德勒谢谢你
/**
* 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'
});
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)