属性或方法“用户”未在实例上定义,但在渲染期间被引用

时间:2019-07-03 06:49:22

标签: laravel vuejs2

            [Vue warn]: Property or method "users" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
[Vue warn]: Property or method "users" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
        [Vue warn]: Property or method "users" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
    [Vue warn]: Property or method "users" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

[Vue警告]:属性或方法“用户”未在实例上定义,但在渲染期间被引用。通过初始化属性,确保该属性在data选项中或对于基于类的组件都是反应性的。

            <template>
                    <div class="container">
                        <div class="row justify-content-center">
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">Dashboard</div>
                                    <div class="card-body">
                                        <h4>Total Subscriber</h4>
                                        <table class="table table-condensed" id="app">
                                            <thead>
                                                <tr>
                                                    <th>Name</th>
                                                    <th>Mobile</th>
                                                    <th>Email</th>
                                                    <th>Address</th>
                                                    <th>DOB</th>
                                                    <th>Selected Plan</th>
                                                </tr>
                                            </thead>
                                            <div id="app">
                                                <tbody>
                                                    <tr v-for = "user in users " :key="user.id">
                                                        <td>@{{ user.name }}</td>
                                                        <td>@{{ user.mobile }}</td>
                                                        <td>@{{ user.email }}</td>
                                                        <td>@{{ user.address }}</td>
                                                        <td>@{{ user.dob }}</td>
                                                        <td>@{{ user.stripe_plan }}</td>   
                                                    </tr> 
                                                </tbody>
                                            </div>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </template>
                <script>
                    export default {
                        data(){
                            return{
                                users: []
                            }
                        },
                        methods: {
                            showUsers(){
                                axios.get('admin/routes').then(response => {
                                    console.log(response);
                                    this.users = response.data;
                                });
                            }
                        },
                       mounted(){
                            this.showUsers();
                       }
                    }
                </script>
        [Vue warn]: Property or method "users" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
    [Vue warn]: Property or method "users" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

[Vue警告]:属性或方法“用户”未在实例上定义,但在渲染期间被引用。通过初始化属性,确保该属性在data选项中或对于基于类的组件都是反应性的。

0 个答案:

没有答案