有如下接口:
@GetMapping("/config/{fileId}")
@ApiOperation("返回配置信息")
public String getConfig(ModelMap map,@PathVariable String fileId,@PathVariable String token){
....
//4、设置视图数据:a、文件类型。b、用户信息。c、文件信息。
map.addAttribute("docType",documentType);
map.addAttribute("user",user);
map.addAttribute("fileManager",fileManager);
//onlineEdit为html页面
return "onlineEdit";
}
此时onlineEdit页面里的js脚本需要使用到docType,那该如何操作?使用 [[${字段}]] 的方式即可获取到。
<!DOCTYPE html>
<html lang="en" style="height: 100%;">
<head>
<meta charset="UTF-8">
<script type="text/javascript" language="javascript" >
var config = {
"type": "desktop",
"mode": "review",
"documentType": "[[${docType}]]",
"document": {
"title": "[[${fileManager.fileName}]]",
"fileType": "[[${fileManager.fileType}]]",
"key": "[[${fileManager.fileManagerId}]]",
"info": {},
...
},
}
</script>
<title>在线编辑文档</title>
</head>
<body style="height: 100%; margin: 0;">
<div id="placeholder" style="height: 100%"></div>
</body>
</html>

4124

被折叠的 条评论
为什么被折叠?



