0
我如何使用下面的这个方法来正确工作?我需要通过阵列中的每个值React JS array forEach使用变量获得参考值
array.forEach((v) => {
let a = `this.refs.a${v}.value`
console.log(a) // prints this.refs.a0.value
console.log(this.refs.a0.value) // prints correct value
})
问题寻求帮助必须包括*所期望的行为*,*一个特定的问题或错误*和*最短的代码必要*重现它在**这个问题本身**。没有**明确问题陈述**的问题对其他读者没有用处。请参阅:[如何创建最小,完整和可验证示例](http://stackoverflow.com/help/mcve)。 –