只是写的很不ES6,不知为什么要这么写呢
wuyanwen opened this issue · 4 comments
douban.find('coming_soon', 1, 3)
.then(d => this.setData({ movies: d.subjects, loading: false }))
.catch(e => {
console.error(e)
this.setData({ movies: [], loading: false })
})
module.exports = {
find (type, page = 1, count = 20, search = '') {
const params = { start: (page - 1) * count, count: count }
return fetchApi(type, search ? Object.assign(params, { q: search }) : params)
.then(res => res.data)
},
findOne (id) {
return fetchApi('subject/' + id)
.then(res => res.data)
}
}
ES5+ES6,只是写的很不ES6 不知为什么要这么写呢
你的描述我不太清楚是什么意思,是不是写错了
没错,你的写法是对的,就是想能不能优化,让人直接一看就是es6的写法,会好些发自网易邮箱大师
在2016年09月30日 17:07,汪磊 写道:你的描述我不太清楚是什么意思,是不是写错了
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/zce/weapp-demo","title":"zce/weapp-demo","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/zce/weapp-demo"}},"updates":{"snippets":[{"icon":"PERSON","message":"@zce in #3: 你的描述我不太清楚是什么意思,是不是写错了"}],"action":{"name":"View Issue","url":"https://github.com/zce/weapp-demo/issues/3#issuecomment-250696721"}}}
一看就是es6写法。
意思是说应该用的更彻底一点呗!谢谢你了建议!我的理解能力太差没看懂你的issue