Javascript Vue计算功能赢得';无法编译语法错误
我的Vue代码中有一个计算元素无法编译,因为在Javascript Vue计算功能赢得';无法编译语法错误,javascript,vue.js,Javascript,Vue.js,我的Vue代码中有一个计算元素无法编译,因为在返回this.dataEvents的第3/4行有一个意外标记 .filter(dataEvent=>!this.filters.title 从逻辑上看,这应该是正确的,但它不会针对语法和令牌错误生成 我做错了什么 computed: { filtered() { return this.dataEvents .filter(dataEvent => !this.filters.title || dataEvent.tit
返回this.dataEvents的第3/4行有一个意外标记
.filter(dataEvent=>!this.filters.title
从逻辑上看,这应该是正确的,但它不会针对语法和令牌错误生成
我做错了什么
computed: {
filtered() {
return this.dataEvents
.filter(dataEvent => !this.filters.title || dataEvent.title === this.filters.title),
.filter(dataEvent => !this.filters.resource || dataEvent.resource === this.filters.resource),
.filter(dataEvent => !this.filters.location || dataEvent.location === this.filters.location),
.filter(dataEvent => !this.filters.status || dataEvent.status === this.filters.status);
},
titles() {
return this.dataEvents.map(dataEvent => dataEvent.title)
.filter((title, index, self) => self.indexOf(title) === index);
},
resources() {
return this.dataEvents
.map(dataEvent => dataEvent.resource)
.filter((resource, index, self) => self.indexOf(resource) === index);
},
locations() {
return this.dataEvents
.map(dataEvent => dataEvent.location)
.filter((location, index, self) => self.indexOf(location) === index);
},
statuses() {
return this.dataEvents
.map(dataEvent => dataEvent.status)
.filter((status, index, self) => self.indexOf(status) === index);
},
},
它不应该在
过滤器
之后添加逗号,啊,好的呼叫!这就解决了它,谢谢!