0

我有一个用例,我需要用输入标签替换“_____”。我正在使用 Reactjs.NET。我以为我可以执行以下操作,但出现错误。

输出是:

错误:未捕获类型错误:无法读取未定义和未捕获错误的属性“getDOMNode”:发生缩小异常;使用未缩小的开发环境获取完整的错误消息和其他有用的警告。

handleEntry:function(){
   var x = this.refs.value1.getDOMNode().value;
   console.log(x);
},
render: function () {
   var DisplayName = "abcd_____ efg _____ ijkl";
   var splitTheString = DisplayName.split('_____');
   var numOfDashes = (DisplayName.match(/_____/g) || []).length;
   if (numOfDashes === 2) {
    return <div>{splitTheString[0]} <input ref="value1" type="text" onBlur={this.handleEntry}/> {splitTheString[1]} <input ref="value2" type="text" onBlur={this.handleEntry}/> {splitTheString[2]}</div>;
    } else {
        return <div>{splitTheString[0]} <input ref="value1" type="text" onBlur={this.handleEntry}/></div>;
    }
}
4

0 回答 0