Преглед изворни кода

代码生成预览语言根据后缀名高亮显示

RuoYi пре 4 година
родитељ
комит
fd8caa01e9
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      ruoyi-generator/src/main/resources/templates/tool/gen/gen.html

+ 3 - 2
ruoyi-generator/src/main/resources/templates/tool/gen/gen.html

@@ -143,10 +143,11 @@
 				if (result.code == web_status.SUCCESS) {
 					 var items = [];
 		                $.each(result.data, function(index, value) {
-		                	var highCode = hljs.highlightAuto(value).value;
 		                    var templateName = index.substring(index.lastIndexOf("/") + 1, index.length).replace(/\.vm/g, "");
 		                    if(!$.common.equals("sql", templateName) && !$.common.equals("tree.html", templateName) && !$.common.equals("sub-domain.java", templateName)){
-			                    items.push({
+		                    	var language = templateName.substring(templateName.lastIndexOf(".") + 1);
+			                    var highCode = hljs.highlight(language, value).value;
+		                    	items.push({
 			                        title: templateName , content: "<pre class=\"layui-code\"><code>" + highCode + "</code></pre>"
 			                    })
 		                    }