CNode

参数带有大括号是什么意思

问答
MMyNodeJs__legacy_5588c0ab01d3ce0d73d69098发布于10 年前最后回复10 年前3 回复5229 浏览0 收藏

{ data ({ to }) { return store.fetchItem(to.params.id).then(item => { document.title = item.title + ' | Vue.js HN Clone' return { item, // the final resolved data can further contain Promises comments: store.fetchItems(item.kids), pollOptions: item.type === 'poll' ? store.fetchItems(item.parts) : null } }) } } 那个to是什么意思?去掉大括号不行吗?

查看回复

回复 (3)

J
jingsam#1·10 年前

参见ES6解构赋值

S
scarletsky#2·10 年前

{ to } 相当于 { to: to },语法糖而已

Z
ziming2018#3·10 年前

不知道

参与回复
登录后即可参与回复。登录