我无法检测到来自文本区域的换行符。该标准.replace('↵', '\n')不起作用,因为在我调用this.state.note返回字符时已经尊重了。
从控制台:
> this.state
{flashMessage: "", note: "one potato ↵two potato↵three potato↵four", showShareModal: false, isEditing: true}
> this.state.note
"one potato
two potato
three potato
four"
我尝试使用 encoudeURI 并在字符串中搜索 '\n' - 两者都没有运气。
有没有办法获得原始格式this.state.note?