Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
b368dd40
authored
Apr 15, 2023
by
芋道源码
Committed by
Gitee
Apr 15, 2023
Browse files
Options
Browse Files
Download
Plain Diff
!128 去除 BPMNJS、FormCreate、Highlight 的全局引入,降低打包后的大小(6.6M -> 1.3M)
Merge pull request !128 from 芋道源码/dev
parents
13057435
9793734f
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
116 additions
and
90 deletions
+116
-90
.env.stage
+31
-0
.env.test
+1
-1
package.json
+1
-0
src/components/bpmnProcessDesigner/package/index.ts
+6
-32
src/components/index.ts
+0
-15
src/main.ts
+0
-20
src/plugins/formCreate/index.ts
+1
-5
src/views/bpm/definition/index.vue
+2
-1
src/views/bpm/form/editor/index.vue
+3
-2
src/views/bpm/model/editor/index.vue
+3
-2
src/views/bpm/model/index.vue
+2
-1
src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue
+2
-2
src/views/infra/build/index.vue
+34
-7
src/views/infra/codegen/PreviewCode.vue
+30
-2
No files found.
.env.stage
0 → 100644
View file @
b368dd40
# 生产环境
NODE_ENV=production
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
# 上传路径
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
# 接口前缀
VITE_API_BASEPATH=
# 接口地址
VITE_API_URL=/admin-api
# 是否删除debugger
VITE_DROP_DEBUGGER=true
# 是否删除console.log
VITE_DROP_CONSOLE=true
# 是否sourcemap
VITE_SOURCEMAP=false
# 打包路径
VITE_BASE_PATH='http://static-vue3.yudao.iocoder.cn/'
# 输出路径
VITE_OUT_DIR=dist-stage
.env.test
View file @
b368dd40
...
@@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=false
...
@@ -25,7 +25,7 @@ VITE_DROP_CONSOLE=false
VITE_SOURCEMAP
=
true
VITE_SOURCEMAP
=
true
# 打包路径
# 打包路径
VITE_BASE_PATH
=/
dist
-
test
/
VITE_BASE_PATH
=/
# 输出路径
# 输出路径
VITE_OUT_DIR
=
dist
-
test
VITE_OUT_DIR
=
dist
-
test
package.json
View file @
b368dd40
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
"ts:check"
:
"vue-tsc --noEmit"
,
"ts:check"
:
"vue-tsc --noEmit"
,
"build:pro"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode pro"
,
"build:pro"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode pro"
,
"build:dev"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode dev"
,
"build:dev"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode dev"
,
"build:stage"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode stage"
,
"build:test"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode test"
,
"build:test"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode test"
,
"build:static"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode static"
,
"build:static"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode static"
,
"build:front"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode front"
,
"build:front"
:
"node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode front"
,
...
...
src/components/bpmnProcessDesigner/package/index.ts
View file @
b368dd40
import
{
App
}
from
'vue'
import
MyProcessDesigner
from
'./designer'
import
MyProcessDesigner
from
'./designer'
import
MyProcessPenal
from
'./penal'
import
MyProcessPenal
from
'./penal'
import
MyProcessViewer
from
'./designer/index2'
import
MyProcessViewer
from
'./designer/index2'
const
components
=
[
MyProcessDesigner
,
MyProcessPenal
,
MyProcessViewer
]
import
'./theme/index.scss'
import
'bpmn-js/dist/assets/diagram-js.css'
import
'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
import
'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
import
'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
// const install = function (Vue) {
export
{
MyProcessDesigner
,
MyProcessPenal
,
MyProcessViewer
}
// components.forEach(component => {
// Vue.component(component.name, component)
// })
// }
// if (typeof window !== "undefined" && window.Vue) {
// install(window.Vue)
// }
// components.forEach(component => {
// Vue.component(component.name, component)
// })
const
componentss
=
{
install
:
(
Vue
:
App
):
void
=>
{
components
.
forEach
((
component
)
=>
{
Vue
.
component
(
component
.
name
,
component
)
})
}
}
// let version = "0.0.1"
export
const
MyPD
=
(
app
)
=>
{
// export default {
// app.use(version)
// app.use(install)
// app.use(MyProcessDesigner)
// app.use(MyProcessPenal)
// app.use(MyProcessViewer)
// app.use(components)
app
.
use
(
componentss
)
}
src/components/index.ts
View file @
b368dd40
import
type
{
App
}
from
'vue'
import
type
{
App
}
from
'vue'
import
{
Icon
}
from
'./Icon'
import
{
Icon
}
from
'./Icon'
import
{
Form
}
from
'@/components/Form'
import
{
Table
}
from
'@/components/Table'
import
{
Search
}
from
'@/components/Search'
import
{
XButton
,
XTextButton
}
from
'@/components/XButton'
import
{
DictTag
}
from
'@/components/DictTag'
import
{
ContentWrap
}
from
'@/components/ContentWrap'
import
{
Descriptions
}
from
'@/components/Descriptions'
export
const
setupGlobCom
=
(
app
:
App
<
Element
>
):
void
=>
{
export
const
setupGlobCom
=
(
app
:
App
<
Element
>
):
void
=>
{
app
.
component
(
'Icon'
,
Icon
)
app
.
component
(
'Icon'
,
Icon
)
app
.
component
(
'Form'
,
Form
)
app
.
component
(
'Table'
,
Table
)
app
.
component
(
'Search'
,
Search
)
app
.
component
(
'XButton'
,
XButton
)
app
.
component
(
'XTextButton'
,
XTextButton
)
app
.
component
(
'DictTag'
,
DictTag
)
app
.
component
(
'ContentWrap'
,
ContentWrap
)
app
.
component
(
'Descriptions'
,
Descriptions
)
}
}
src/main.ts
View file @
b368dd40
...
@@ -37,16 +37,6 @@ import App from './App.vue'
...
@@ -37,16 +37,6 @@ import App from './App.vue'
import
'./permission'
import
'./permission'
import
{
MyPD
}
from
'@/components/bpmnProcessDesigner/package/index.js'
import
'@/components/bpmnProcessDesigner/package/theme/index.scss'
import
'bpmn-js/dist/assets/diagram-js.css'
import
'bpmn-js/dist/assets/bpmn-font/css/bpmn.css'
import
'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css'
import
'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
import
hljs
from
'highlight.js'
//导入代码高亮文件
import
'highlight.js/styles/github.css'
//导入代码高亮样式 新版
import
'@/plugins/tongji'
// 百度统计
import
'@/plugins/tongji'
// 百度统计
import
Logger
from
'@/utils/Logger'
import
Logger
from
'@/utils/Logger'
...
@@ -55,18 +45,8 @@ import Logger from '@/utils/Logger'
...
@@ -55,18 +45,8 @@ import Logger from '@/utils/Logger'
const
setupAll
=
async
()
=>
{
const
setupAll
=
async
()
=>
{
const
app
=
createApp
(
App
)
const
app
=
createApp
(
App
)
//自定义一个代码高亮指令
app
.
directive
(
'highlight'
,
function
(
el
)
{
const
blocks
=
el
.
querySelectorAll
(
'code'
)
blocks
.
forEach
((
block
:
any
)
=>
{
hljs
.
highlightElement
(
block
)
})
})
await
setupI18n
(
app
)
await
setupI18n
(
app
)
MyPD
(
app
)
setupStore
(
app
)
setupStore
(
app
)
setupGlobCom
(
app
)
setupGlobCom
(
app
)
...
...
src/plugins/formCreate/index.ts
View file @
b368dd40
...
@@ -17,7 +17,6 @@ import {
...
@@ -17,7 +17,6 @@ import {
import
formCreate
from
'@form-create/element-ui'
import
formCreate
from
'@form-create/element-ui'
import
install
from
'@form-create/element-ui/auto-import'
import
install
from
'@form-create/element-ui/auto-import'
import
FcDesigner
from
'@form-create/designer'
const
components
=
[
const
components
=
[
ElAside
,
ElAside
,
...
@@ -34,14 +33,11 @@ const components = [
...
@@ -34,14 +33,11 @@ const components = [
ElTabPane
ElTabPane
]
]
// 参考 http://www.form-create.com/v3/element-ui/auto-import.html 文档
export
const
setupFormCreate
=
(
app
:
App
<
Element
>
)
=>
{
export
const
setupFormCreate
=
(
app
:
App
<
Element
>
)
=>
{
components
.
forEach
((
component
)
=>
{
components
.
forEach
((
component
)
=>
{
app
.
component
(
component
.
name
,
component
)
app
.
component
(
component
.
name
,
component
)
})
})
formCreate
.
use
(
install
)
formCreate
.
use
(
install
)
app
.
use
(
formCreate
)
app
.
use
(
formCreate
)
app
.
use
(
FcDesigner
)
}
}
src/views/bpm/definition/index.vue
View file @
b368dd40
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
<!-- 弹窗:流程模型图的预览 -->
<!-- 弹窗:流程模型图的预览 -->
<Dialog
title=
"流程图"
v-model=
"bpmnDetailVisible"
width=
"800"
>
<Dialog
title=
"流程图"
v-model=
"bpmnDetailVisible"
width=
"800"
>
<
my-process-v
iewer
<
MyProcessV
iewer
key=
"designer"
key=
"designer"
v-model=
"bpmnXML"
v-model=
"bpmnXML"
:value=
"bpmnXML"
:value=
"bpmnXML"
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
<
script
setup
lang=
"ts"
name=
"BpmProcessDefinition"
>
<
script
setup
lang=
"ts"
name=
"BpmProcessDefinition"
>
import
{
DICT_TYPE
}
from
'@/utils/dict'
import
{
DICT_TYPE
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
MyProcessViewer
}
from
'@/components/bpmnProcessDesigner/package'
import
*
as
DefinitionApi
from
'@/api/bpm/definition'
import
*
as
DefinitionApi
from
'@/api/bpm/definition'
import
{
setConfAndFields2
}
from
'@/utils/formCreate'
import
{
setConfAndFields2
}
from
'@/utils/formCreate'
const
{
push
}
=
useRouter
()
// 路由
const
{
push
}
=
useRouter
()
// 路由
...
...
src/views/bpm/form/editor/index.vue
View file @
b368dd40
<
template
>
<
template
>
<ContentWrap>
<ContentWrap>
<!-- 表单设计器 -->
<!-- 表单设计器 -->
<
fc-d
esigner
ref=
"designer"
height=
"780px"
>
<
FcD
esigner
ref=
"designer"
height=
"780px"
>
<template
#
handle
>
<template
#
handle
>
<el-button
round
size=
"small"
type=
"primary"
@
click=
"handleSave"
>
<el-button
round
size=
"small"
type=
"primary"
@
click=
"handleSave"
>
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
保存
保存
</el-button>
</el-button>
</
template
>
</
template
>
</
fc-d
esigner>
</
FcD
esigner>
</ContentWrap>
</ContentWrap>
<!-- 表单保存的弹窗 -->
<!-- 表单保存的弹窗 -->
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
*
as
FormApi
from
'@/api/bpm/form'
import
*
as
FormApi
from
'@/api/bpm/form'
import
FcDesigner
from
'@form-create/designer'
import
{
encodeConf
,
encodeFields
,
setConfAndFields
}
from
'@/utils/formCreate'
import
{
encodeConf
,
encodeFields
,
setConfAndFields
}
from
'@/utils/formCreate'
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
...
...
src/views/bpm/model/editor/index.vue
View file @
b368dd40
<
template
>
<
template
>
<ContentWrap>
<ContentWrap>
<!-- 流程设计器,负责绘制流程等 -->
<!-- 流程设计器,负责绘制流程等 -->
<
my-process-d
esigner
<
MyProcessD
esigner
key=
"designer"
key=
"designer"
v-if=
"xmlString !== undefined"
v-if=
"xmlString !== undefined"
v-model=
"xmlString"
v-model=
"xmlString"
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
@
save=
"save"
@
save=
"save"
/>
/>
<!-- 流程属性器,负责编辑每个流程节点的属性 -->
<!-- 流程属性器,负责编辑每个流程节点的属性 -->
<
my-properties-pane
l
<
MyProcessPena
l
key=
"penal"
key=
"penal"
:bpmnModeler=
"modeler"
:bpmnModeler=
"modeler"
:prefix=
"controlForm.prefix"
:prefix=
"controlForm.prefix"
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
name=
"BpmModelEditor"
>
<
script
setup
lang=
"ts"
name=
"BpmModelEditor"
>
import
{
MyProcessDesigner
,
MyProcessPenal
}
from
'@/components/bpmnProcessDesigner/package'
// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)
// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)
import
CustomContentPadProvider
from
'@/components/bpmnProcessDesigner/package/designer/plugins/content-pad'
import
CustomContentPadProvider
from
'@/components/bpmnProcessDesigner/package/designer/plugins/content-pad'
// 自定义左侧菜单(修改 默认任务 为 用户任务)
// 自定义左侧菜单(修改 默认任务 为 用户任务)
...
...
src/views/bpm/model/index.vue
View file @
b368dd40
...
@@ -216,7 +216,7 @@
...
@@ -216,7 +216,7 @@
<!-- 弹窗:流程模型图的预览 -->
<!-- 弹窗:流程模型图的预览 -->
<Dialog
title=
"流程图"
v-model=
"bpmnDetailVisible"
width=
"800"
>
<Dialog
title=
"流程图"
v-model=
"bpmnDetailVisible"
width=
"800"
>
<
my-process-v
iewer
<
MyProcessV
iewer
key=
"designer"
key=
"designer"
v-model=
"bpmnXML"
v-model=
"bpmnXML"
:value=
"bpmnXML"
:value=
"bpmnXML"
...
@@ -229,6 +229,7 @@
...
@@ -229,6 +229,7 @@
<
script
setup
lang=
"ts"
name=
"BpmModel"
>
<
script
setup
lang=
"ts"
name=
"BpmModel"
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
,
formatDate
}
from
'@/utils/formatTime'
import
{
dateFormatter
,
formatDate
}
from
'@/utils/formatTime'
import
{
MyProcessViewer
}
from
'@/components/bpmnProcessDesigner/package'
import
*
as
ModelApi
from
'@/api/bpm/model'
import
*
as
ModelApi
from
'@/api/bpm/model'
import
*
as
FormApi
from
'@/api/bpm/form'
import
*
as
FormApi
from
'@/api/bpm/form'
import
ModelForm
from
'./ModelForm.vue'
import
ModelForm
from
'./ModelForm.vue'
...
...
src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue
View file @
b368dd40
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<template
#
header
>
<template
#
header
>
<span
class=
"el-icon-picture-outline"
>
流程图
</span>
<span
class=
"el-icon-picture-outline"
>
流程图
</span>
</
template
>
</
template
>
<
my-process-v
iewer
<
MyProcessV
iewer
key=
"designer"
key=
"designer"
:activityData=
"activityList"
:activityData=
"activityList"
:prefix=
"bpmnControlForm.prefix"
:prefix=
"bpmnControlForm.prefix"
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
</template>
</template>
<
script
lang=
"ts"
name=
"BpmProcessInstanceBpmnViewer"
setup
>
<
script
lang=
"ts"
name=
"BpmProcessInstanceBpmnViewer"
setup
>
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
MyProcessViewer
}
from
'@/components/bpmnProcessDesigner/package'
import
*
as
ActivityApi
from
'@/api/bpm/activity'
import
*
as
ActivityApi
from
'@/api/bpm/activity'
// import * as DefinitionApi from '@/api/bpm/definition'
const
props
=
defineProps
({
const
props
=
defineProps
({
loading
:
propTypes
.
bool
,
// 是否加载中
loading
:
propTypes
.
bool
,
// 是否加载中
...
...
src/views/infra/build/index.vue
View file @
b368dd40
...
@@ -4,13 +4,13 @@
...
@@ -4,13 +4,13 @@
<el-col>
<el-col>
<div
class=
"mb-2 float-right"
>
<div
class=
"mb-2 float-right"
>
<el-button
size=
"small"
type=
"primary"
@
click=
"showJson"
>
生成 JSON
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"showJson"
>
生成 JSON
</el-button>
<el-button
size=
"small"
type=
"success"
@
click=
"showOption"
>
生成
O
ptions
</el-button>
<el-button
size=
"small"
type=
"success"
@
click=
"showOption"
>
生成
O
ptions
</el-button>
<el-button
size=
"small"
type=
"danger"
@
click=
"showTemplate"
>
生成组件
</el-button>
<el-button
size=
"small"
type=
"danger"
@
click=
"showTemplate"
>
生成组件
</el-button>
</div>
</div>
</el-col>
</el-col>
<!-- 表单设计器 -->
<!-- 表单设计器 -->
<el-col>
<el-col>
<
fc-d
esigner
ref=
"designer"
height=
"780px"
/>
<
FcD
esigner
ref=
"designer"
height=
"780px"
/>
</el-col>
</el-col>
</el-row>
</el-row>
</ContentWrap>
</ContentWrap>
...
@@ -22,18 +22,17 @@
...
@@ -22,18 +22,17 @@
{{
t
(
'common.copy'
)
}}
{{
t
(
'common.copy'
)
}}
</el-button>
</el-button>
<el-scrollbar
height=
"580"
>
<el-scrollbar
height=
"580"
>
<div
v-highlight
>
<div>
<code
class=
"hljs"
>
<pre><code
class=
"hljs"
v-html=
"highlightedCode(formData)"
></code></pre>
{{
formData
}}
</code>
</div>
</div>
</el-scrollbar>
</el-scrollbar>
</div>
</div>
</Dialog>
</Dialog>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
name=
"InfraBuild"
>
<
script
setup
lang=
"ts"
name=
"InfraBuild"
>
import
formCreate
from
'@form-create/element-ui
'
import
FcDesigner
from
'@form-create/designer
'
import
{
useClipboard
}
from
'@vueuse/core'
import
{
useClipboard
}
from
'@vueuse/core'
import
{
isString
}
from
'@/utils/is'
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息
const
message
=
useMessage
()
// 消息
...
@@ -109,4 +108,32 @@ const copy = async (text: string) => {
...
@@ -109,4 +108,32 @@ const copy = async (text: string) => {
}
}
}
}
}
}
/**
* 代码高亮
*/
import
hljs
from
'highlight.js'
// 导入代码高亮文件
import
'highlight.js/styles/github.css'
// 导入代码高亮样式
import
xml
from
'highlight.js/lib/languages/java'
import
json
from
'highlight.js/lib/languages/json'
const
highlightedCode
=
(
code
)
=>
{
// 处理语言和代码
let
language
=
'json'
if
(
formType
.
value
===
2
)
{
language
=
'xml'
}
if
(
!
isString
(
code
))
{
code
=
JSON
.
stringify
(
code
)
}
// 高亮
const
result
=
hljs
.
highlight
(
language
,
code
,
true
)
return
result
.
value
||
' '
}
/** 初始化 **/
onMounted
(
async
()
=>
{
// 注册代码高亮的各种语言
hljs
.
registerLanguage
(
'xml'
,
xml
)
hljs
.
registerLanguage
(
'json'
,
json
)
})
</
script
>
</
script
>
src/views/infra/codegen/PreviewCode.vue
View file @
b368dd40
...
@@ -45,8 +45,8 @@
...
@@ -45,8 +45,8 @@
<el-button
class=
"float-right"
text
type=
"primary"
@
click=
"copy(item.code)"
>
<el-button
class=
"float-right"
text
type=
"primary"
@
click=
"copy(item.code)"
>
{{
t
(
'common.copy'
)
}}
{{
t
(
'common.copy'
)
}}
</el-button>
</el-button>
<div
v-highlight
>
<div>
<
code>
{{
item
.
code
}}
</cod
e>
<
pre><code
class=
"hljs"
v-html=
"highlightedCode(item)"
></code></pr
e>
</div>
</div>
</el-tab-pane>
</el-tab-pane>
</el-tabs>
</el-tabs>
...
@@ -180,6 +180,34 @@ const copy = async (text: string) => {
...
@@ -180,6 +180,34 @@ const copy = async (text: string) => {
message
.
success
(
t
(
'common.copySuccess'
))
message
.
success
(
t
(
'common.copySuccess'
))
}
}
}
}
/**
* 代码高亮
*/
import
hljs
from
'highlight.js'
// 导入代码高亮文件
import
'highlight.js/styles/github.css'
// 导入代码高亮样式
import
java
from
'highlight.js/lib/languages/java'
import
xml
from
'highlight.js/lib/languages/java'
import
javascript
from
'highlight.js/lib/languages/javascript'
import
sql
from
'highlight.js/lib/languages/sql'
import
typescript
from
'highlight.js/lib/languages/typescript'
const
highlightedCode
=
(
item
)
=>
{
const
language
=
item
.
filePath
.
substring
(
item
.
filePath
.
lastIndexOf
(
'.'
)
+
1
)
const
result
=
hljs
.
highlight
(
language
,
item
.
code
||
''
,
true
)
return
result
.
value
||
' '
}
/** 初始化 **/
onMounted
(
async
()
=>
{
// 注册代码高亮的各种语言
hljs
.
registerLanguage
(
'java'
,
java
)
hljs
.
registerLanguage
(
'xml'
,
xml
)
hljs
.
registerLanguage
(
'html'
,
xml
)
hljs
.
registerLanguage
(
'vue'
,
xml
)
hljs
.
registerLanguage
(
'javascript'
,
javascript
)
hljs
.
registerLanguage
(
'sql'
,
sql
)
hljs
.
registerLanguage
(
'typescript'
,
typescript
)
})
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.app-infra-codegen-preview-container
{
.app-infra-codegen-preview-container
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment