正如op所说,他们正在从数据库中获取模板。我认为这是一个字符串。您可以使用它来创建模板文字。
const template = "<p>This is the <strong>default </strong>CKEditor installation.${name} Source editing is provided by the Source Editing Area</a> plugin.</p><p>Follow the${city}steps below to try it${country}out:</p><ul><li>Click the <strong>Source </strong>button to display the HTML source of this tex ${website} ${email}in the source editing area.</li><li>Click the <strong>Source </strong>button again to return to the WYSIWYG view.</li></ul><form>First name:<br>"const replacements = [{ "name": "Lijo", "city": "Banglaore", "country": "India", "website": "", "email": "" }, { "name": "Thoams", "city": "Chennai", "country": "India", "website": "", "email": "" }]const inset = new Function('name', 'city', 'country', 'website', 'email', 'return `' + template + '`')const filledIn = replacements .map(({ name, city, country, website, email }) => inset(name, city, country, website, email) )console.log(filledIn)


