Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel Vuejs+;拉威尔:如何统计记录_Laravel_Vue.js_Count_Console.log - Fatal编程技术网

Laravel Vuejs+;拉威尔:如何统计记录

Laravel Vuejs+;拉威尔:如何统计记录,laravel,vue.js,count,console.log,Laravel,Vue.js,Count,Console.log,vue组件的代码: data() { return { patrons : {}, } }, methods: { loadPatron(){ axios.get("api/patron") .then(({data}) => (th

vue组件的代码:

        data() {
            return {
                patrons : {},
              }
            },
            methods: {
              loadPatron(){
                   axios.get("api/patron")
                       .then(({data}) => (this.patrons= data.data));


              //Count records
              console.log(this.patrons.length); //This line of code does not seem to work.
              },
            }

我们如何计算记录并将其显示在console.log中?

分配后,您必须将
console.log
放在axios get函数中

axios.get(“api/用户”)
。然后({data})=>{
this.customers=data.data
console.log(this.customers);
});
或者为
用户
属性和
控制台创建观察者。在那里记录

观察:{
顾客:{
处理程序:函数(){
console.log(this.customers)
},
深:是的
}
}

您必须将
控制台.log
放置在分配后的axios get函数中

axios.get(“api/用户”)
。然后({data})=>{
this.customers=data.data
console.log(this.customers);
});
或者为
用户
属性和
控制台创建观察者。在那里记录

观察:{
顾客:{
处理程序:函数(){
console.log(this.customers)
},
深:是的
}
}

对不起,我是新来的。我该怎么做?如果你有时间,你可以展示代码。谢谢。对不起,我是新来的。我该怎么做?如果你有时间,你可以展示代码。非常感谢。