Explorar o código

代码生成预览支持高亮显示

RuoYi %!s(int64=5) %!d(string=hai) anos
pai
achega
dddbaeb5c0
Modificáronse 3 ficheiros con 7 adicións e 2 borrados
  1. 1 0
      ruoyi-ui/package.json
  2. 5 1
      ruoyi-ui/src/main.js
  3. 1 1
      ruoyi-ui/src/views/tool/gen/index.vue

+ 1 - 0
ruoyi-ui/package.json

@@ -44,6 +44,7 @@
44
     "element-ui": "2.14.1",
44
     "element-ui": "2.14.1",
45
     "file-saver": "2.0.4",
45
     "file-saver": "2.0.4",
46
     "fuse.js": "6.4.3",
46
     "fuse.js": "6.4.3",
47
+    "highlight.js": "10.4.1",
47
     "js-beautify": "1.13.0",
48
     "js-beautify": "1.13.0",
48
     "js-cookie": "2.2.1",
49
     "js-cookie": "2.2.1",
49
     "jsencrypt": "3.0.0-rc.1",
50
     "jsencrypt": "3.0.0-rc.1",

+ 5 - 1
ruoyi-ui/src/main.js

@@ -19,8 +19,11 @@ import { getDicts } from "@/api/system/dict/data";
19
 import { getConfigKey } from "@/api/system/config";
19
 import { getConfigKey } from "@/api/system/config";
20
 import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
20
 import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
21
 import Pagination from "@/components/Pagination";
21
 import Pagination from "@/components/Pagination";
22
-//自定义表格工具扩展
22
+// 自定义表格工具扩展
23
 import RightToolbar from "@/components/RightToolbar"
23
 import RightToolbar from "@/components/RightToolbar"
24
+// 代码高亮插件
25
+import hljs from 'highlight.js'
26
+import 'highlight.js/styles/github-gist.css'
24
 
27
 
25
 // 全局方法挂载
28
 // 全局方法挂载
26
 Vue.prototype.getDicts = getDicts
29
 Vue.prototype.getDicts = getDicts
@@ -50,6 +53,7 @@ Vue.component('Pagination', Pagination)
50
 Vue.component('RightToolbar', RightToolbar)
53
 Vue.component('RightToolbar', RightToolbar)
51
 
54
 
52
 Vue.use(permission)
55
 Vue.use(permission)
56
+Vue.use(hljs.vuePlugin);
53
 
57
 
54
 /**
58
 /**
55
  * If you don't want to use mock-server
59
  * If you don't want to use mock-server

+ 1 - 1
ruoyi-ui/src/views/tool/gen/index.vue

@@ -165,7 +165,7 @@
165
           :name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
165
           :name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
166
           :key="key"
166
           :key="key"
167
         >
167
         >
168
-          <pre>{{ value }}</pre>
168
+          <highlightjs autodetect :code="value" />
169
         </el-tab-pane>
169
         </el-tab-pane>
170
       </el-tabs>
170
       </el-tabs>
171
     </el-dialog>
171
     </el-dialog>