添加 latpl 应用安全提示注释

pull/1424/head
贤心 2023-11-17 09:57:36 +08:00
parent 99bc35a06c
commit 5895e84785
2 changed files with 24 additions and 18 deletions

View File

@ -98,6 +98,8 @@ compile.render(data, callback); // 模板渲染
{{- d.include("/laytpl/detail/options.md") }}
</div>
> ### 注意
> 开发者在使用模板语法时,需确保模板中的 JS 语句不来自于页面用户输入,即必须在页面开发者自身的可控范围内,否则请避免使用该模板引擎。
<h2 id="config" lay-toc="{level: 2}">属性配置</h2>

View File

@ -118,6 +118,10 @@ layui.define(function(exports){
template = '"use strict";var view = "' + template + '";return view;';
try {
/**
* 请注意: 开发者在使用模板语法时需确保模板中的 JS 语句不来自于页面用户输入
* 即模板中的 JS 语句必须在页面开发者自身的可控范围内否则请避免使用该模板解析
*/
that.cache = template = new Function('d, laytpl', template);
return template(data, tool);
} catch(e) {