【发布时间】:2021-07-25 00:33:09
【问题描述】:
我正在开发我的 MERN 应用程序,其中包含一个文本区域。我想让用户在文本模板之间添加变量。例如,enter image description here
如何使用 React 和 Node JS 实现这个逻辑?
【问题讨论】:
-
你应该使用
contenteditablediv
标签: node.js reactjs express mern
我正在开发我的 MERN 应用程序,其中包含一个文本区域。我想让用户在文本模板之间添加变量。例如,enter image description here
如何使用 React 和 Node JS 实现这个逻辑?
【问题讨论】:
contenteditable div
标签: node.js reactjs express mern
假设,后端收到的字符串是:
let email = "Hi John, I hope you are doing good".
现在,要检索名称 John,我们可以这样做:
let indexOfSpace = email.indexOf(" ");
let indexOfComma = email.indexOf(",");
let name = email.substring(indexOfSpace, indexOfComma);
你可以研究一下这些方法here。
【讨论】: