跳到主要内容
CNode

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

问答
MMyNodeJs__legacy_5588c0ab01d3ce0d73d69098发布于 10 年前最后回复 10 年前
352530

{ 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)

Z
ziming2018#310 年前

不知道

S
scarletsky#210 年前

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

J
jingsam#110 年前

参见ES6解构赋值

参与回复

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