我将数据插入到 HTML 中,如下所示:
<p each="{this.holidayListFirstPart}" if="{hdate}">
<span id="{description}" onclick={showInputBox}>{hdate}:{description}</span>
</p>
我正在尝试将span
标签转换为textarea
on mouseclick,以便用户可以像这样编辑文本:
showInputBox(e) {
self.textContent = document.getElementById(e.target.id).innerHTML;
var mySpan = document.getElementById(e.target.id);
var customTextArea = document.createElement("textarea");
customTextArea.id = e.target.id;
customTextArea.setAttribute('onmouseout','{focusGone}');
customTextArea.innerHTML = self.textContent;
mySpan.parentNode.replaceChild(customTextArea, mySpan);
}
focusGone(e){
console.log("lost focus");
}
问题是当用户在编辑文本后离开 textarea 时,它会抛出该focusGone
函数未定义的错误:
Uncaught ReferenceError: focusGone is not defined
我如何在 riotjs 中完成这项工作?