|
|
|
@ -169,7 +169,7 @@
@@ -169,7 +169,7 @@
|
|
|
|
|
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))" |
|
|
|
|
:key="key" |
|
|
|
|
> |
|
|
|
|
<highlightjs autodetect :code="value" /> |
|
|
|
|
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre> |
|
|
|
|
</el-tab-pane> |
|
|
|
|
</el-tabs> |
|
|
|
|
</el-dialog> |
|
|
|
@ -181,6 +181,14 @@
@@ -181,6 +181,14 @@
|
|
|
|
|
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"; |
|
|
|
|
import importTable from "./importTable"; |
|
|
|
|
import { downLoadZip } from "@/utils/zipdownload"; |
|
|
|
|
import hljs from "highlight.js/lib/highlight"; |
|
|
|
|
import "highlight.js/styles/github-gist.css"; |
|
|
|
|
hljs.registerLanguage("java", require("highlight.js/lib/languages/java")); |
|
|
|
|
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); |
|
|
|
|
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml")); |
|
|
|
|
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml")); |
|
|
|
|
hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript")); |
|
|
|
|
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql")); |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "Gen", |
|
|
|
@ -294,6 +302,13 @@ export default {
@@ -294,6 +302,13 @@ export default {
|
|
|
|
|
this.preview.open = true; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
/** 高亮显示 */ |
|
|
|
|
highlightedCode(code, key) { |
|
|
|
|
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm")); |
|
|
|
|
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length); |
|
|
|
|
const result = hljs.highlight(language, code || "", true); |
|
|
|
|
return result.value || ' '; |
|
|
|
|
}, |
|
|
|
|
// 多选框选中数据 |
|
|
|
|
handleSelectionChange(selection) { |
|
|
|
|
this.ids = selection.map(item => item.tableId); |
|
|
|
|