javascript - 带有 vue.js、quasar 和 ES6 的数组理解合成器
问题描述
我想在我的类星体项目中使用数组理解。Quasar 版本:0.17.* Vue.js 版本:2.9.6,使用 es6(又名 ES2015)
当我使用:
let newList = oldList.map(function (item) { return item.value })
一切都按预期工作。但是当我使用:
let newList = [for (item of oldList) item.value]
我得到以下信息synthax error
:
Failed to compile.
[...]
13:26 error Parsing error: Unexpected token
11 | export function setList (state, oldList) {
12 |
> 13 | let newList = [for (item of oldList) item.value]
| ^
14 |
为什么 ?这个合成器不应该也是正确的吗?
解决方案
推荐阅读
- java - C# 转换中的 HttpURLConnection REST API
- python - 如何以更快的方式从数据框中删除一系列行
- python - 遵循 Odoo 教程 - 无处可去 - 似乎很正常
- php - 在 AWS 上运行 PHP 和 R
- reactjs - 在提交时使用成功或错误消息反应更新表单
- java - 从 ByteBuffer 中获取位
- java - 忽略拆分 \\w+ 上的点
- reactjs - Hooks:如何获取全局状态(this.state)?
- docusignapi - docusign 自定义连接器定价计划和 API 基本路径疑问
- powerbi - 如何在 DAX 中计算每日人口