参数带有大括号是什么意思
发布于 8 年前 作者 MyNodeJs 4497 次浏览 来自 问答

{ 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 回复

参见ES6解构赋值

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

回到顶部