Vue js警告消息与laravel

时间:2017-03-12 13:19:12

标签: javascript php laravel vuejs2 laravel-5.4

我正在使用Laravel5.4和vuejs 2.我没有得到响应但是在控制台中有一些错误。请帮我解决这个错误。它给出了错误  [Vue警告]:挂钩和TypeError出错:无法读取属性&get; get。 我在下面提到了错误消息。我使用npm installnpm 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="{{ $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'
});

,错误信息是:

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)

0 个答案:

没有答案