Php 呈现中出错:TypeError:无法读取laravel vuejs中未定义的属性标题
我在如何以v-for显示数据方面遇到了问题。我一直在跟踪此链接视频时间Php 呈现中出错:TypeError:无法读取laravel vuejs中未定义的属性标题,php,laravel,vue.js,Php,Laravel,Vue.js,我在如何以v-for显示数据方面遇到了问题。我一直在跟踪此链接视频时间9:29,但它显示错误无法读取属性。有可能是拉威尔的版本吗?如果有人能弄明白,那就太好了,提前多谢了 模板 号码是:{{views} 增加 增加 {{user.title}} {{user.post} 剧本 导出默认值{ 数据(){ 返回{ 浏览次数:0, 博客:[], } }, 方法:{ 更新计数器(编号){ 这个.视图+=数量; } }, 创建(){ 这个.视图=100 让posts=[{title:'这是blo
9:29
,但它显示错误无法读取属性。有可能是拉威尔的版本吗?如果有人能弄明白,那就太好了,提前多谢了
模板
号码是:{{views}
增加
增加
{{user.title}}
{{user.post}
剧本
导出默认值{
数据(){
返回{
浏览次数:0,
博客:[],
}
},
方法:{
更新计数器(编号){
这个.视图+=数量;
}
},
创建(){
这个.视图=100
让posts=[{title:'这是blog 1','post':'这是blog post 1',id:1},
{title:'这是博客2','post':'这是博客2',id:2},
{title:'这是blog 3','post':'这是blog post 3',id:3},
{title:'这是博客4','post':'这是博客4',id:4},
,]
this.blogs=帖子
}
}
您的代码很好,只需删除多余的'Comma'
更改
,]with]
您的代码很好,只需删除多余的“逗号”
用]更改您应该使用的已创建函数的
,]
created(){
this.views = 100
let posts = [{title: 'this is blog 1', 'post' : 'this is blog post 1', id:1},
{title: 'this is blog 2', 'post' : 'this is blog post 2', id:2},
{title: 'this is blog 3', 'post' : 'this is blog post 3', id:3},
{title: 'this is blog 4', 'post' : 'this is blog post 4', id:4}
,]
this.blogs = posts
}
在创建的函数上,您应该使用
created(){
this.views = 100
let posts = [{title: 'this is blog 1', 'post' : 'this is blog post 1', id:1},
{title: 'this is blog 2', 'post' : 'this is blog post 2', id:2},
{title: 'this is blog 3', 'post' : 'this is blog post 3', id:3},
{title: 'this is blog 4', 'post' : 'this is blog post 4', id:4}
,]
this.blogs = posts
}
打字错误在数组末尾(数组中第四项之后)有一个额外的,
。你需要移除它,它工作正常。从技术上讲,您有两个额外的,
,因为您的第四项是数组中的最后一项。。。在数组末尾(数组中第四项之后)有一个额外的,
。你需要移除它,它工作正常。从技术上讲,您有两个额外的,
,因为您的第四项是阵列中的最后一项。
created(){
this.views = 100
let posts = [{title: 'this is blog 1', 'post' : 'this is blog post 1', id:1},
{title: 'this is blog 2', 'post' : 'this is blog post 2', id:2},
{title: 'this is blog 3', 'post' : 'this is blog post 3', id:3},
{title: 'this is blog 4', 'post' : 'this is blog post 4', id:4}
,]
this.blogs = posts
}