javascript - 从响应中隐藏部分 javascript 代码
问题描述
您好我有一个包含模板的 js 文件。
data["isShowEdit"] = isShowEdit;
smartScreen.template = {
showAction: _.template("<div class=\"SmartScreenDesignAction\" >" +
"<% if (isShowEdit) { %> <a href=\"#\" class=\"btn btn-xs btn-default smartScreen-edit\" rel=\"{{id}}\"><i class=\"fa fa-pencil\"></i></a> <% } %>" +
"<a href=\"#\" class=\"btn btn-xs btn-default smartScreen-delete\"rel=\"{{id}}\" ><i class=\"fa fa-trash-o\"></i></a>" +
"</div>"),
showActionColumn: _.template("<div class=\"SmartScreenDesignInputAction\">" +
"<a href=\"#\" class=\"btn btn-xs btn-default smartScreen-delete\" rel=\"{{id}}\"><i class=\"fa fa-trash-o\"></i></a>" +
"</div>")
我的问题是可以在响应中看到代码的第一部分(showAction:_template isShowEdit 部分)。我希望这部分只出现在后端,因为它会导致安全漏洞。
我怎样才能隐藏这部分。提前致谢。
解决方案
推荐阅读
- reactjs - 道具验证中缺少 React Redux 以及使用 redux-observable 从外部 API 初始化容器的推荐模式
- excel - 如何在一系列合并和未合并的单元格周围放置边框
- powershell - 如何使用 PowerShell 向 google API 发送 BatchRequest
- scala - 如何在地图内加载带有火花的文件
- html - SVG 无法缩放
- java - 如何避免工厂类中的“级联 if\case”语句
- firebase - 检查项目是否存在于 Firebase 安全规则的子集合中
- bash - 在 bash 脚本中检查日志文件中的错误时出现条件问题
- python - 触摸并影响任何物体
- wpf - WPD DataGrid 中的文本对齐