在 4.4.3.2 小节 更新配置数据
文中代码 和 代码清单: src/models/Config.js 的 update() 函数。
src/models/Config.js
update()
在作者的代码仓库 update() 已修改为:
update(password, update = {}, silent = false) { // ... return filmyBucket.fetchPutToken(password, 'config.json') .then(putToken => { return Config.load(silent) .then(oldConfig => [ oldConfig, putToken ]) .catch(() => [ {}, putToken ]) }) .then(([ config, putToken ]) => { config = config || {} for (const key of Object.keys(update)) { config[key] = update[key] } // ... }) }
4.6.1 路由组件开发
这里所有 花括号 {} 替换为 尖括号 <>,与 HTML 语法一样
{content}{/content} => {Content}{/Content}
文中 components 的 Content 应和 HTML 标签一样区分大小写(c 改为 C):
components
Content
c
C
{content :categories="categories"}{/content} => {Content :categories="categories"}{/Content}
Windows Egde改为Windows Edge
//多参数 (foo + bar) => { return foo + bar }
应该修改为
//多参数 (foo, bar) => { return foo + bar }
3.2.1.3 无参数箭头函数
关于函数式编程和面向对象编程的举例中,可采用解构和简写属性名的特性,进一步优化代码, 有助于读者理解 ES6 的语法。
const names = ['Will', 'Jack', 'Peter', 'Steve', 'John', 'Hugo', 'Mike'] const newSet = names .map((name, index) => ({ id: index, name //name: name })) .filter(({id} = man) => id % 2 === 0 ) //filter(man => man.id % 2 === 0 ) .map(({name} = man) => [ name ]) //map(man => [ man.name ]) .reduce((a, b) => a.concat(b)) console.log(newSet) //=> ["Will", "Peter", "John", "Mike"]
在 4.4.3.2 小节 更新配置数据
文中代码 和 代码清单:
src/models/Config.js
的update()
函数。在作者的代码仓库
update()
已修改为:4.6.1 路由组件开发
这里所有 花括号 {} 替换为 尖括号 <>,与 HTML 语法一样
文中
components
的Content
应和 HTML 标签一样区分大小写(c
改为C
):Windows Egde改为Windows Edge
应该修改为
3.2.1.3 无参数箭头函数
关于函数式编程和面向对象编程的举例中,可采用解构和简写属性名的特性,进一步优化代码, 有助于读者理解 ES6 的语法。