TypeError:无法读取未定义的属性“目标”-反应

时间:2019-10-17 04:23:16

标签: reactjs react-native

←→页面上3个错误中的1个

  

TypeError:无法读取未定义的属性“ target”

App.inputChangeHandler
src/App.js:37
  34 | 
  35 | inputChangeHandler(index,event){
  36 | const mProducts = this.state.product;
> 37 | mProducts[index].eName = event.target.value;
     | ^  38 | this.setState({
  39 |   product:mProducts
  40 | })
View compiled
▶ 22 stack frames were collapsed.

1 个答案:

答案 0 :(得分:0)

我相信当您在调用函数时忘记传递Sub Tester() Dim lastRow As Long Dim sht As Worksheet, rng As Range Dim dict As Object, v, c As Range, c2 As Range Set dict = CreateObject("scripting.dictionary") With ActiveSheet 'always use a worksheet reference... Set rng = .Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row) End With For Each c In rng.Cells v = c.Value Set c2 = c.Offset(0, 1) 'potential row to recolor (orange)? If Len(v) > 0 And c2.Interior.ColorIndex = 44 Then If dict.exists(v) Then 'is there a previous cell to color? If Not dict(v) Is Nothing Then dict(v).Interior.ColorIndex = 3 'color the previous one Set dict(v) = Nothing 'clear previous End If c2.Interior.ColorIndex = 3 'color the current one Else Set dict(v) = c2 'first orange one - remember it End If End If Next c End Sub 时会触发此类错误。

我认为您的输入看起来像这样,

event

这里您还没有提供<input onChange={() => this.inputChangeHandler(1)} value={this.state.value} /> ,这会给您带来错误

  

错误:无法读取未定义的属性“目标”

您应提供event之类的

event

Demo