Javascript 在es6模板字符串中使用此关键字并将该字符串传递给危险的HTML ` ${optionsList} `
我想将类函数传递给onchange属性,但此模板字符串返回到Javascript 在es6模板字符串中使用此关键字并将该字符串传递给危险的HTML ` ${optionsList} `,javascript,reactjs,contenteditable,Javascript,Reactjs,Contenteditable,我想将类函数传递给onchange属性,但此模板字符串返回到危险的setinerhtml。因此它说,this.handleDropDown不是一个函数。 我不知道怎样才能通过考试 this.handledropdown不是一个函数拼写matters@CertainPerformance改变it@YashSharma您在构造函数中绑定了this.handleDropDown()吗?在react onchange中是这样写的onChange@SubhanshuPandey-我用的是胖箭operato
危险的setinerhtml
。因此它说,this.handleDropDown不是一个函数
。
我不知道怎样才能通过考试
this.handledropdown不是一个函数
拼写matters@CertainPerformance改变it@YashSharma您在构造函数中绑定了this.handleDropDown()吗?在react onchange中是这样写的onChange@SubhanshuPandey-我用的是胖箭operator@SubhanshuPandey-但它被传递给AngerouslySetinerHTML,因此不能使用onChange
`<span>
<span contentEditable="false">
<select
selected=${currentPlaceholder.selected.value}
onchange ={this.handleDropDown(${index})}
class="custom-dropdown"
>
${optionsList}
</select>
</span>
</span>`