vue2-client 1.8.166 → 1.8.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +19 -19
- package/.eslintrc.js +90 -90
- package/CHANGELOG.md +824 -824
- package/Components.md +60 -60
- package/babel.config.js +21 -21
- package/docs/index.md +30 -30
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.config.js +21 -21
- package/jest.setup.js +7 -7
- package/package.json +97 -97
- package/public/index.html +27 -27
- package/src/App.vue +164 -164
- package/src/ReportView.js +19 -19
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/assets/svg/badtwo.svg +1 -1
- package/src/assets/svg/goodtwo.svg +1 -1
- package/src/base-client/components/common/AMisRender/index.js +3 -3
- package/src/base-client/components/common/AMisRender/index.vue +263 -263
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
- package/src/base-client/components/common/CreateQuery/index.js +3 -3
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
- package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
- package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/Tree.vue +149 -149
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/Upload.vue +197 -197
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddForm/XAddForm.vue +92 -92
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +502 -502
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
- package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
- package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
- package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -117
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +83 -83
- package/src/base-client/components/common/XForm/XForm.vue +253 -253
- package/src/base-client/components/common/XForm/XFormItem.vue +545 -545
- package/src/base-client/components/common/XForm/XTreeSelect.vue +191 -191
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
- package/src/base-client/components/common/XFormTable/XFormTable.vue +418 -418
- package/src/base-client/components/common/XFormTable/index.md +98 -98
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -131
- package/src/base-client/components/common/XReport/XReport.vue +694 -694
- package/src/base-client/components/common/XReport/XReportDesign.vue +423 -414
- package/src/base-client/components/common/XReport/XReportTrGroup.vue +602 -596
- package/src/base-client/components/common/XReport/index.js +3 -3
- package/src/base-client/components/common/XReport/index.md +44 -44
- package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
- package/src/base-client/components/common/XReportSlot/index.js +3 -3
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/XTable.vue +549 -549
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/common/XTree/XTree.vue +76 -76
- package/src/base-client/components/common/XTree/index.js +3 -3
- package/src/base-client/components/common/XTree/index.md +36 -36
- package/src/base-client/components/index.js +47 -47
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/plugins/AppData.js +115 -115
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/GetLoginInfoService.js +182 -182
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/bootstrap.js +39 -39
- package/src/components/CodeMirror/inedx.vue +118 -118
- package/src/components/CodeMirror/setting.js +40 -40
- package/src/components/FilePreview/FilePreview.vue +166 -166
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/STable/index.js +323 -323
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/config/CreateQueryConfig.js +322 -322
- package/src/config/default/antd.config.js +89 -89
- package/src/config/default/setting.config.js +53 -53
- package/src/font-style/font.css +4 -4
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +138 -138
- package/src/layouts/header/AdminHeader.vue +132 -132
- package/src/layouts/header/HeaderNotice.vue +177 -177
- package/src/layouts/tabs/TabsHead.vue +189 -189
- package/src/layouts/tabs/TabsView.vue +387 -387
- package/src/lib.js +1 -1
- package/src/main.js +26 -26
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/AMisDemo/AMisDemo.vue +325 -325
- package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
- package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
- package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
- package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
- package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
- package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
- package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
- package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
- package/src/pages/DynamicStatistics/index.vue +282 -282
- package/src/pages/Example/index.vue +1432 -1305
- package/src/pages/ServiceReview/index.vue +284 -284
- package/src/pages/XReportView/index.vue +62 -62
- package/src/pages/login/Login.vue +378 -378
- package/src/pages/login/LoginV3.vue +389 -389
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/pages/system/settings/modifyPassword.vue +117 -117
- package/src/pages/system/ticket/index.vue +480 -480
- package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
- package/src/router/async/config.async.js +32 -32
- package/src/router/async/router.map.js +98 -98
- package/src/router/guards.js +214 -214
- package/src/router/index.js +27 -27
- package/src/router.js +18 -18
- package/src/services/api/TicketDetailsViewApi.js +46 -46
- package/src/services/api/cas.js +79 -79
- package/src/services/api/common.js +274 -274
- package/src/services/api/entity.js +18 -18
- package/src/services/api/index.js +17 -17
- package/src/services/api/restTools.js +46 -46
- package/src/services/apiService.js +14 -14
- package/src/services/user.js +71 -71
- package/src/store/modules/setting.js +119 -119
- package/src/theme/default/style.less +57 -57
- package/src/utils/authority-utils.js +85 -85
- package/src/utils/errorCode.js +6 -6
- package/src/utils/htmlToPDF.js +108 -108
- package/src/utils/htmlToPDFApi.js +5 -5
- package/src/utils/indexedDB.js +201 -201
- package/src/utils/login.js +141 -141
- package/src/utils/map-utils.js +47 -47
- package/src/utils/request.js +343 -343
- package/src/utils/routerUtil.js +428 -428
- package/src/utils/util.js +231 -231
- package/src/utils/waterMark.js +31 -31
- package/test/Amis.spec.js +163 -163
- package/test/Tree.spec.js +167 -167
- package/test/myDialog.spec.js +46 -46
- package/vue.config.js +166 -166
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
const TabsPagePlugin = {
|
|
2
|
-
install (Vue) {
|
|
3
|
-
Vue.mixin({
|
|
4
|
-
methods: {
|
|
5
|
-
$closePage (closeRoute, nextRoute) {
|
|
6
|
-
const event = new CustomEvent('page:close', { detail: { closeRoute, nextRoute } })
|
|
7
|
-
window.dispatchEvent(event)
|
|
8
|
-
},
|
|
9
|
-
$refreshPage (route) {
|
|
10
|
-
const path = typeof route === 'object' ? route.path : route
|
|
11
|
-
const event = new CustomEvent('page:refresh', { detail: { pageKey: path } })
|
|
12
|
-
window.dispatchEvent(event)
|
|
13
|
-
},
|
|
14
|
-
$openPage (route, title) {
|
|
15
|
-
this.$setPageTitle(route, title)
|
|
16
|
-
this.$router.push(route)
|
|
17
|
-
},
|
|
18
|
-
$setPageTitle (route, title) {
|
|
19
|
-
if (title) {
|
|
20
|
-
// let path = typeof route === 'object' ? route.path : route
|
|
21
|
-
// path = path && path.split('?')[0]
|
|
22
|
-
const path = typeof route === 'object' ? this.$router.resolve(route).route.fullPath : route
|
|
23
|
-
this.$store.commit('setting/setCustomTitle', { path, title })
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
computed: {
|
|
28
|
-
customTitle () {
|
|
29
|
-
const customTitles = this.$store.state.setting.customTitles
|
|
30
|
-
// const path = this.$route.path.split('?')[0]
|
|
31
|
-
const custom = customTitles.find(item => item.path === this.$route.fullPath)
|
|
32
|
-
return custom && custom.title
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default TabsPagePlugin
|
|
1
|
+
const TabsPagePlugin = {
|
|
2
|
+
install (Vue) {
|
|
3
|
+
Vue.mixin({
|
|
4
|
+
methods: {
|
|
5
|
+
$closePage (closeRoute, nextRoute) {
|
|
6
|
+
const event = new CustomEvent('page:close', { detail: { closeRoute, nextRoute } })
|
|
7
|
+
window.dispatchEvent(event)
|
|
8
|
+
},
|
|
9
|
+
$refreshPage (route) {
|
|
10
|
+
const path = typeof route === 'object' ? route.path : route
|
|
11
|
+
const event = new CustomEvent('page:refresh', { detail: { pageKey: path } })
|
|
12
|
+
window.dispatchEvent(event)
|
|
13
|
+
},
|
|
14
|
+
$openPage (route, title) {
|
|
15
|
+
this.$setPageTitle(route, title)
|
|
16
|
+
this.$router.push(route)
|
|
17
|
+
},
|
|
18
|
+
$setPageTitle (route, title) {
|
|
19
|
+
if (title) {
|
|
20
|
+
// let path = typeof route === 'object' ? route.path : route
|
|
21
|
+
// path = path && path.split('?')[0]
|
|
22
|
+
const path = typeof route === 'object' ? this.$router.resolve(route).route.fullPath : route
|
|
23
|
+
this.$store.commit('setting/setCustomTitle', { path, title })
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
computed: {
|
|
28
|
+
customTitle () {
|
|
29
|
+
const customTitles = this.$store.state.setting.customTitles
|
|
30
|
+
// const path = this.$route.path.split('?')[0]
|
|
31
|
+
const custom = customTitles.find(item => item.path === this.$route.fullPath)
|
|
32
|
+
return custom && custom.title
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default TabsPagePlugin
|
package/src/bootstrap.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import { loadRoutes, loadGuards, setAppOptions } from '@vue2-client/utils/routerUtil'
|
|
3
|
-
import { loadInterceptors } from '@vue2-client/utils/request'
|
|
4
|
-
import guards from '@vue2-client/router/guards'
|
|
5
|
-
import interceptors from '@vue2-client/utils/axios-interceptors'
|
|
6
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 启动引导方法
|
|
10
|
-
* 应用启动时需要执行的操作放在这里
|
|
11
|
-
* @param router 应用的路由实例
|
|
12
|
-
* @param store 应用的 vuex.store 实例
|
|
13
|
-
* @param i18n 应用的 vue-i18n 实例
|
|
14
|
-
* @param message 应用的 message 实例
|
|
15
|
-
*/
|
|
16
|
-
async function bootstrap ({ router, store, i18n, message }) {
|
|
17
|
-
Vue.$store = store
|
|
18
|
-
// 获取系统配置
|
|
19
|
-
if (store) {
|
|
20
|
-
await getConfigByName('webConfig', undefined, res => {
|
|
21
|
-
localStorage.setItem(process.env.VUE_APP_WEB_CONFIG_KEY, JSON.stringify(res))
|
|
22
|
-
if (res.setting) {
|
|
23
|
-
Vue.$store.commit('setting/setSetting', res.setting)
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
// 设置应用配置
|
|
28
|
-
setAppOptions({ router, store, i18n })
|
|
29
|
-
// 加载 axios 拦截器
|
|
30
|
-
loadInterceptors(interceptors, { router, store, i18n, message })
|
|
31
|
-
if (router) {
|
|
32
|
-
// 加载路由
|
|
33
|
-
loadRoutes()
|
|
34
|
-
// 加载路由守卫
|
|
35
|
-
loadGuards(guards, { router, store, i18n, message })
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default bootstrap
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import { loadRoutes, loadGuards, setAppOptions } from '@vue2-client/utils/routerUtil'
|
|
3
|
+
import { loadInterceptors } from '@vue2-client/utils/request'
|
|
4
|
+
import guards from '@vue2-client/router/guards'
|
|
5
|
+
import interceptors from '@vue2-client/utils/axios-interceptors'
|
|
6
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 启动引导方法
|
|
10
|
+
* 应用启动时需要执行的操作放在这里
|
|
11
|
+
* @param router 应用的路由实例
|
|
12
|
+
* @param store 应用的 vuex.store 实例
|
|
13
|
+
* @param i18n 应用的 vue-i18n 实例
|
|
14
|
+
* @param message 应用的 message 实例
|
|
15
|
+
*/
|
|
16
|
+
async function bootstrap ({ router, store, i18n, message }) {
|
|
17
|
+
Vue.$store = store
|
|
18
|
+
// 获取系统配置
|
|
19
|
+
if (store) {
|
|
20
|
+
await getConfigByName('webConfig', undefined, res => {
|
|
21
|
+
localStorage.setItem(process.env.VUE_APP_WEB_CONFIG_KEY, JSON.stringify(res))
|
|
22
|
+
if (res.setting) {
|
|
23
|
+
Vue.$store.commit('setting/setSetting', res.setting)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
// 设置应用配置
|
|
28
|
+
setAppOptions({ router, store, i18n })
|
|
29
|
+
// 加载 axios 拦截器
|
|
30
|
+
loadInterceptors(interceptors, { router, store, i18n, message })
|
|
31
|
+
if (router) {
|
|
32
|
+
// 加载路由
|
|
33
|
+
loadRoutes()
|
|
34
|
+
// 加载路由守卫
|
|
35
|
+
loadGuards(guards, { router, store, i18n, message })
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default bootstrap
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<codemirror
|
|
3
|
-
v-model="item"
|
|
4
|
-
:options="cmOption"
|
|
5
|
-
class="code-mirror"
|
|
6
|
-
:style="styleObj"
|
|
7
|
-
@ready="onCmReady"
|
|
8
|
-
@focus="onCmFocus"
|
|
9
|
-
@input="onCmCodeChange"
|
|
10
|
-
ref="myCmGenerate"></codemirror>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import { codemirror } from 'vue-codemirror'
|
|
15
|
-
import 'codemirror/mode/javascript/javascript.js'
|
|
16
|
-
import './setting.js'
|
|
17
|
-
// https://github.com/surmon-china/vue-codemirror/tree/v4.0.6
|
|
18
|
-
export default {
|
|
19
|
-
components: {
|
|
20
|
-
codemirror
|
|
21
|
-
},
|
|
22
|
-
props: {
|
|
23
|
-
value: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: ''
|
|
26
|
-
},
|
|
27
|
-
readonly: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
mode: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: 'sql' // 目前只有 sql/go/js 如果需要配置其他语言,需要在 setting.js 中配置 更多看官方文档
|
|
34
|
-
},
|
|
35
|
-
styleObj: {
|
|
36
|
-
type: Object,
|
|
37
|
-
default: () => {
|
|
38
|
-
return { fontSize: '16px' }
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
theme: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: 'dracula'
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
watch: {},
|
|
47
|
-
data () {
|
|
48
|
-
return {
|
|
49
|
-
item: this.value,
|
|
50
|
-
cmOption: {
|
|
51
|
-
autoCloseBrackets: true,
|
|
52
|
-
extraKeys: { Ctrl: 'autocomplete' },
|
|
53
|
-
foldGutter: true,
|
|
54
|
-
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
|
|
55
|
-
highlightSelectionMatches: { showToken: /\w/, annotateScrollbar: true },
|
|
56
|
-
hintOptions: { completeSingle: false },
|
|
57
|
-
keyMap: 'sublime',
|
|
58
|
-
line: true,
|
|
59
|
-
lineNumbers: true,
|
|
60
|
-
matchBrackets: true,
|
|
61
|
-
mode: { name: this.mode, json: true },
|
|
62
|
-
readOnly: this.readonly ? 'nocursor' : undefined,
|
|
63
|
-
showCursorWhenSelecting: true,
|
|
64
|
-
styleActiveLine: true,
|
|
65
|
-
styleSelectedText: true,
|
|
66
|
-
tabSize: 2,
|
|
67
|
-
theme: this.theme,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
methods: {
|
|
72
|
-
onCmReady () {
|
|
73
|
-
},
|
|
74
|
-
onCmFocus (instance, event) {
|
|
75
|
-
// console.log(instance)
|
|
76
|
-
// console.log(event)
|
|
77
|
-
},
|
|
78
|
-
onCmCodeChange (instance, _obj) {
|
|
79
|
-
this.$emit('input', instance)
|
|
80
|
-
// console.log(instance)
|
|
81
|
-
// console.log(_obj)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
</script>
|
|
86
|
-
<style lang="less" scoped>
|
|
87
|
-
.CodeMirror-scroll {
|
|
88
|
-
overflow: scroll !important;
|
|
89
|
-
margin-bottom: 0;
|
|
90
|
-
margin-right: 0;
|
|
91
|
-
padding-bottom: 0;
|
|
92
|
-
height: 100%;
|
|
93
|
-
outline: none;
|
|
94
|
-
position: relative;
|
|
95
|
-
border: 1px solid #dddddd;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@font-face {
|
|
99
|
-
font-family: 'JetBrains Mono';
|
|
100
|
-
src: url('@vue2-client/assets/ttf/JetBrainsMono-Light.woff2') format('woff2'), /* 字体文件路径和格式 */ url('@vue2-client/assets/ttf/JetBrainsMono-Light.woff2') format('woff');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
:deep(.CodeMirror) {
|
|
104
|
-
height: 100%;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.code-mirror {
|
|
108
|
-
height: 100%;
|
|
109
|
-
line-height: 150%;
|
|
110
|
-
text-align: left;
|
|
111
|
-
font-family: "JetBrains Mono", serif !important;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:deep(.CodeMirror-line), :deep(.CodeMirror-line-like) {
|
|
115
|
-
font-family: "JetBrains Mono", serif !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<codemirror
|
|
3
|
+
v-model="item"
|
|
4
|
+
:options="cmOption"
|
|
5
|
+
class="code-mirror"
|
|
6
|
+
:style="styleObj"
|
|
7
|
+
@ready="onCmReady"
|
|
8
|
+
@focus="onCmFocus"
|
|
9
|
+
@input="onCmCodeChange"
|
|
10
|
+
ref="myCmGenerate"></codemirror>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { codemirror } from 'vue-codemirror'
|
|
15
|
+
import 'codemirror/mode/javascript/javascript.js'
|
|
16
|
+
import './setting.js'
|
|
17
|
+
// https://github.com/surmon-china/vue-codemirror/tree/v4.0.6
|
|
18
|
+
export default {
|
|
19
|
+
components: {
|
|
20
|
+
codemirror
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
value: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ''
|
|
26
|
+
},
|
|
27
|
+
readonly: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
mode: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'sql' // 目前只有 sql/go/js 如果需要配置其他语言,需要在 setting.js 中配置 更多看官方文档
|
|
34
|
+
},
|
|
35
|
+
styleObj: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: () => {
|
|
38
|
+
return { fontSize: '16px' }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
theme: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'dracula'
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
watch: {},
|
|
47
|
+
data () {
|
|
48
|
+
return {
|
|
49
|
+
item: this.value,
|
|
50
|
+
cmOption: {
|
|
51
|
+
autoCloseBrackets: true,
|
|
52
|
+
extraKeys: { Ctrl: 'autocomplete' },
|
|
53
|
+
foldGutter: true,
|
|
54
|
+
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
|
|
55
|
+
highlightSelectionMatches: { showToken: /\w/, annotateScrollbar: true },
|
|
56
|
+
hintOptions: { completeSingle: false },
|
|
57
|
+
keyMap: 'sublime',
|
|
58
|
+
line: true,
|
|
59
|
+
lineNumbers: true,
|
|
60
|
+
matchBrackets: true,
|
|
61
|
+
mode: { name: this.mode, json: true },
|
|
62
|
+
readOnly: this.readonly ? 'nocursor' : undefined,
|
|
63
|
+
showCursorWhenSelecting: true,
|
|
64
|
+
styleActiveLine: true,
|
|
65
|
+
styleSelectedText: true,
|
|
66
|
+
tabSize: 2,
|
|
67
|
+
theme: this.theme,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
onCmReady () {
|
|
73
|
+
},
|
|
74
|
+
onCmFocus (instance, event) {
|
|
75
|
+
// console.log(instance)
|
|
76
|
+
// console.log(event)
|
|
77
|
+
},
|
|
78
|
+
onCmCodeChange (instance, _obj) {
|
|
79
|
+
this.$emit('input', instance)
|
|
80
|
+
// console.log(instance)
|
|
81
|
+
// console.log(_obj)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
<style lang="less" scoped>
|
|
87
|
+
.CodeMirror-scroll {
|
|
88
|
+
overflow: scroll !important;
|
|
89
|
+
margin-bottom: 0;
|
|
90
|
+
margin-right: 0;
|
|
91
|
+
padding-bottom: 0;
|
|
92
|
+
height: 100%;
|
|
93
|
+
outline: none;
|
|
94
|
+
position: relative;
|
|
95
|
+
border: 1px solid #dddddd;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@font-face {
|
|
99
|
+
font-family: 'JetBrains Mono';
|
|
100
|
+
src: url('@vue2-client/assets/ttf/JetBrainsMono-Light.woff2') format('woff2'), /* 字体文件路径和格式 */ url('@vue2-client/assets/ttf/JetBrainsMono-Light.woff2') format('woff');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:deep(.CodeMirror) {
|
|
104
|
+
height: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.code-mirror {
|
|
108
|
+
height: 100%;
|
|
109
|
+
line-height: 150%;
|
|
110
|
+
text-align: left;
|
|
111
|
+
font-family: "JetBrains Mono", serif !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:deep(.CodeMirror-line), :deep(.CodeMirror-line-like) {
|
|
115
|
+
font-family: "JetBrains Mono", serif !important;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
</style>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import 'codemirror/lib/codemirror.css'
|
|
2
|
-
// require active-line.js
|
|
3
|
-
import 'codemirror/addon/selection/active-line.js'
|
|
4
|
-
// styleSelectedText
|
|
5
|
-
import 'codemirror/addon/selection/mark-selection.js'
|
|
6
|
-
// hint
|
|
7
|
-
import 'codemirror/addon/hint/show-hint.js'
|
|
8
|
-
import 'codemirror/addon/hint/sql-hint.js'
|
|
9
|
-
import 'codemirror/addon/hint/show-hint.css'
|
|
10
|
-
import 'codemirror/addon/hint/javascript-hint.js'
|
|
11
|
-
// highlightSelectionMatches
|
|
12
|
-
import 'codemirror/addon/scroll/annotatescrollbar.js'
|
|
13
|
-
import 'codemirror/addon/search/matchesonscrollbar.js'
|
|
14
|
-
import 'codemirror/addon/search/match-highlighter.js'
|
|
15
|
-
// keyMap
|
|
16
|
-
import 'codemirror/mode/go/go.js'
|
|
17
|
-
import 'codemirror/mode/sql/sql.js'
|
|
18
|
-
import 'codemirror/mode/javascript/javascript.js'
|
|
19
|
-
import 'codemirror/addon/edit/matchbrackets.js'
|
|
20
|
-
import 'codemirror/addon/comment/comment.js'
|
|
21
|
-
import 'codemirror/addon/dialog/dialog.js'
|
|
22
|
-
import 'codemirror/addon/dialog/dialog.css'
|
|
23
|
-
import 'codemirror/addon/search/searchcursor.js'
|
|
24
|
-
import 'codemirror/addon/search/search.js'
|
|
25
|
-
import 'codemirror/keymap/sublime.js'
|
|
26
|
-
// foldGutter
|
|
27
|
-
import 'codemirror/addon/fold/foldgutter.css'
|
|
28
|
-
import 'codemirror/addon/fold/brace-fold.js'
|
|
29
|
-
import 'codemirror/addon/fold/comment-fold.js'
|
|
30
|
-
import 'codemirror/addon/fold/foldcode.js'
|
|
31
|
-
import 'codemirror/addon/fold/foldgutter.js'
|
|
32
|
-
import 'codemirror/addon/fold/indent-fold.js'
|
|
33
|
-
import 'codemirror/addon/fold/markdown-fold.js'
|
|
34
|
-
import 'codemirror/addon/fold/xml-fold.js'
|
|
35
|
-
// 编辑的主题文件
|
|
36
|
-
import 'codemirror/theme/dracula.css'
|
|
37
|
-
import 'codemirror/theme/base16-light.css'
|
|
38
|
-
import 'codemirror/theme/monokai.css'
|
|
39
|
-
// 括号自动不全
|
|
40
|
-
import 'codemirror/addon/edit/closebrackets.js'
|
|
1
|
+
import 'codemirror/lib/codemirror.css'
|
|
2
|
+
// require active-line.js
|
|
3
|
+
import 'codemirror/addon/selection/active-line.js'
|
|
4
|
+
// styleSelectedText
|
|
5
|
+
import 'codemirror/addon/selection/mark-selection.js'
|
|
6
|
+
// hint
|
|
7
|
+
import 'codemirror/addon/hint/show-hint.js'
|
|
8
|
+
import 'codemirror/addon/hint/sql-hint.js'
|
|
9
|
+
import 'codemirror/addon/hint/show-hint.css'
|
|
10
|
+
import 'codemirror/addon/hint/javascript-hint.js'
|
|
11
|
+
// highlightSelectionMatches
|
|
12
|
+
import 'codemirror/addon/scroll/annotatescrollbar.js'
|
|
13
|
+
import 'codemirror/addon/search/matchesonscrollbar.js'
|
|
14
|
+
import 'codemirror/addon/search/match-highlighter.js'
|
|
15
|
+
// keyMap
|
|
16
|
+
import 'codemirror/mode/go/go.js'
|
|
17
|
+
import 'codemirror/mode/sql/sql.js'
|
|
18
|
+
import 'codemirror/mode/javascript/javascript.js'
|
|
19
|
+
import 'codemirror/addon/edit/matchbrackets.js'
|
|
20
|
+
import 'codemirror/addon/comment/comment.js'
|
|
21
|
+
import 'codemirror/addon/dialog/dialog.js'
|
|
22
|
+
import 'codemirror/addon/dialog/dialog.css'
|
|
23
|
+
import 'codemirror/addon/search/searchcursor.js'
|
|
24
|
+
import 'codemirror/addon/search/search.js'
|
|
25
|
+
import 'codemirror/keymap/sublime.js'
|
|
26
|
+
// foldGutter
|
|
27
|
+
import 'codemirror/addon/fold/foldgutter.css'
|
|
28
|
+
import 'codemirror/addon/fold/brace-fold.js'
|
|
29
|
+
import 'codemirror/addon/fold/comment-fold.js'
|
|
30
|
+
import 'codemirror/addon/fold/foldcode.js'
|
|
31
|
+
import 'codemirror/addon/fold/foldgutter.js'
|
|
32
|
+
import 'codemirror/addon/fold/indent-fold.js'
|
|
33
|
+
import 'codemirror/addon/fold/markdown-fold.js'
|
|
34
|
+
import 'codemirror/addon/fold/xml-fold.js'
|
|
35
|
+
// 编辑的主题文件
|
|
36
|
+
import 'codemirror/theme/dracula.css'
|
|
37
|
+
import 'codemirror/theme/base16-light.css'
|
|
38
|
+
import 'codemirror/theme/monokai.css'
|
|
39
|
+
// 括号自动不全
|
|
40
|
+
import 'codemirror/addon/edit/closebrackets.js'
|