JavaScript从回调函数为变量赋值

时间:2017-06-16 02:29:42

标签: javascript

我尝试从回调中为变量赋值,但在 console.log 中,它显示 undefined

我做错了什么?

var threadsList = threads(data => {
  return data
})

console.log(threadsList)

1 个答案:

答案 0 :(得分:0)

解决!

threads(data => {
  this.$data.threads = data
})