当服务端Freemarker输出的值是包含换行符的字符串,并且输出到前端需要作为javascript变量或常量的值,需要使用js_string进行转换,否则换行符可能会导致javascript语法异常,正确示例:
{ selfIntroduction: ‘${userInfo.selfIntroduction?js_string}‘ }
Web前端开发规范
原文:https://www.cnblogs.com/miaoyinruanjian/p/9466914.html