@xfu0401/form-generator 1.0.1 → 1.0.2
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/package.json +1 -1
- package/.eslintrc.js +0 -48
- package/LICENSE +0 -127
- package/README.md +0 -268
- package/babel.config.js +0 -22
- package/public/favicon.ico +0 -0
- package/public/img/show/PixPin_2024-07-17_16-25-59.gif +0 -0
- package/public/img/show/PixPin_2024-07-17_16-33-51.png +0 -0
- package/public/img/show/file.png +0 -0
- package/public/img/show/image.png +0 -0
- package/public/img/show/pc/347/253/257/346/270/262/346/237/223.png +0 -0
- package/public/img/show/pc/347/253/257/350/257/246/346/203/205.png +0 -0
- package/public/img/show//344/272/213/344/273/266.png +0 -0
- package/public/img/show//345/205/250/345/261/200/344/272/213/344/273/266.png +0 -0
- package/public/img/show//345/205/250/345/261/200/346/240/267/345/274/217.png +0 -0
- package/public/img/show//346/240/267/345/274/217/345/261/236/346/200/247.png +0 -0
- package/public/img/show//347/247/273/345/212/250/347/253/257/346/270/262/346/237/223.png +0 -0
- package/public/img/show//347/247/273/345/212/250/347/253/257/350/257/246/346/203/205.png +0 -0
- package/public/img/show//347/274/226/350/276/221/345/231/2502.png +0 -0
- package/public/img/show//347/274/226/350/276/221/345/231/2503.png +0 -0
- package/public/img/show//347/274/226/350/276/221/345/231/2504.png +0 -0
- package/public/img/temp//344/270/273/344/273/216/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/210/206/347/273/204/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/215/225/345/210/227/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/233/272/345/256/232/350/241/250/346/240/274/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/244/232/345/210/227/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//346/240/207/347/255/276/351/241/265/350/241/250/345/215/225.jpg +0 -0
- package/public/index.html +0 -25
- package/public/static/js/config.js +0 -2
- package/src/App.vue +0 -18
- package/src/api/data.js +0 -52
- package/src/components/Layout/Layout.vue +0 -28
- package/src/components/Layout/LeftMenu.vue +0 -46
- package/src/components/SvgIcon/index.vue +0 -43
- package/src/components/code/Code.vue +0 -98
- package/src/components/common/FGDialog.vue +0 -100
- package/src/components/editor/CodeDialog.vue +0 -68
- package/src/components/editor/CodeEditor.vue +0 -191
- package/src/components/editor/CodeJson.vue +0 -130
- package/src/components/editor/CssEditor.vue +0 -84
- package/src/components/editor/EventEditor.vue +0 -84
- package/src/components/editor/JsonDialog.vue +0 -55
- package/src/components/editor/JsonEditor.vue +0 -58
- package/src/components/editor/components/EditorLeft.vue +0 -138
- package/src/components/fileComs/ExportExcel.vue +0 -49
- package/src/components/fileComs/ExportJson.vue +0 -52
- package/src/components/fileComs/ImportExcel.vue +0 -96
- package/src/components/fileComs/ImportJson.vue +0 -65
- package/src/components/formGenerator/components/formExport.vue +0 -52
- package/src/components/formGenerator/components/formGeneratorAttrField.vue +0 -1113
- package/src/components/formGenerator/components/formGeneratorAttrForm.vue +0 -98
- package/src/components/formGenerator/components/formGeneratorCom.vue +0 -108
- package/src/components/formGenerator/components/formGeneratorOutline.vue +0 -159
- package/src/components/formGenerator/components/formGeneratorTemp.vue +0 -77
- package/src/components/formGenerator/components/formImport.vue +0 -62
- package/src/components/formGenerator/components/formPreview.vue +0 -102
- package/src/components/formGenerator/configComponents/DataConfig.vue +0 -156
- package/src/components/formGenerator/configComponents/DataDialog.vue +0 -188
- package/src/components/formGenerator/configComponents/EventConfig.vue +0 -56
- package/src/components/formGenerator/configComponents/PageConfig.vue +0 -55
- package/src/components/formGenerator/configComponents/RegConfig.vue +0 -105
- package/src/components/formGenerator/configComponents/ShadowConfig.vue +0 -95
- package/src/components/formGenerator/configComponents/SpaceConfig.vue +0 -187
- package/src/components/formGenerator/configComponents/StyleConfig.vue +0 -258
- package/src/components/formGenerator/configComponents/TableConfig.vue +0 -75
- package/src/components/formGenerator/configComponents/TableHead.vue +0 -126
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formButton.vue +0 -25
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formDivider.vue +0 -49
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formHtml.vue +0 -37
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formLink.vue +0 -26
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formNotice.vue +0 -118
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formRemark.vue +0 -29
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formSwipe.vue +0 -39
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTable.vue +0 -130
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTableExport.vue +0 -282
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTag.vue +0 -30
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formText.vue +0 -27
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTree.vue +0 -47
- package/src/components/formGenerator/formComponents/pcComponents/components/emptyTips.vue +0 -24
- package/src/components/formGenerator/formComponents/pcComponents/components/esignDialog.vue +0 -86
- package/src/components/formGenerator/formComponents/pcComponents/components/filesShow.vue +0 -120
- package/src/components/formGenerator/formComponents/pcComponents/components/imageShow.vue +0 -148
- package/src/components/formGenerator/formComponents/pcComponents/components/nameShow.vue +0 -54
- package/src/components/formGenerator/formComponents/pcComponents/components/tableOptions.vue +0 -56
- package/src/components/formGenerator/formComponents/pcComponents/components/tableStyle.vue +0 -58
- package/src/components/formGenerator/formComponents/pcComponents/components/userPicker.vue +0 -439
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formAutocomplete.vue +0 -79
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formInput.vue +0 -56
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formInputNumber.vue +0 -51
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formRichText.vue +0 -138
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formCard.vue +0 -35
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formCollapse.vue +0 -79
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formRowContainer.vue +0 -333
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formSteps.vue +0 -90
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formSub.vue +0 -219
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formTableContainer.vue +0 -277
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formTabsContainer.vue +0 -65
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formCascader.vue +0 -62
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formCheckboxGroup.vue +0 -70
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formColorPicker.vue +0 -39
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formDatePicker.vue +0 -43
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formDaterangePicker.vue +0 -40
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formImage.vue +0 -235
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formOrgPicker.vue +0 -131
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formRadioGroup.vue +0 -59
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formRate.vue +0 -50
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSelect.vue +0 -62
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSignature.vue +0 -98
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSlider.vue +0 -46
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSwitch.vue +0 -37
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formTimePicker.vue +0 -41
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formTimerangePicker.vue +0 -40
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formUpload.vue +0 -253
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formUploadTemp.vue +0 -82
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formUserPicker.vue +0 -142
- package/src/components/formGenerator/formComponents/pcForm.vue +0 -151
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formButton.vue +0 -36
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formDivider.vue +0 -41
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formHtml.vue +0 -37
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formLink.vue +0 -49
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formNotice.vue +0 -43
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formRemark.vue +0 -39
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formSwipe.vue +0 -34
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTable.vue +0 -132
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTableExport.vue +0 -117
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTag.vue +0 -147
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formText.vue +0 -27
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTree.vue +0 -21
- package/src/components/formGenerator/formComponents/phoneComponents/components/cascaderPicker.vue +0 -81
- package/src/components/formGenerator/formComponents/phoneComponents/components/datePicker.vue +0 -101
- package/src/components/formGenerator/formComponents/phoneComponents/components/esignDialog.vue +0 -156
- package/src/components/formGenerator/formComponents/phoneComponents/components/filesShow.vue +0 -127
- package/src/components/formGenerator/formComponents/phoneComponents/components/imageShow.vue +0 -123
- package/src/components/formGenerator/formComponents/phoneComponents/components/nameShow.vue +0 -84
- package/src/components/formGenerator/formComponents/phoneComponents/components/orgPicker.vue +0 -343
- package/src/components/formGenerator/formComponents/phoneComponents/components/tableShow.vue +0 -149
- package/src/components/formGenerator/formComponents/phoneComponents/components/textShow.vue +0 -25
- package/src/components/formGenerator/formComponents/phoneComponents/components/timePicker.vue +0 -90
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formAutocomplete.vue +0 -163
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formInput.vue +0 -111
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formInputNumber.vue +0 -65
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formRichText.vue +0 -147
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formCard.vue +0 -59
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formCollapse.vue +0 -71
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formRowContainer.vue +0 -90
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formSteps.vue +0 -112
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formSub.vue +0 -130
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formTableContainer.vue +0 -93
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formTabsContainer.vue +0 -64
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formCascader.vue +0 -210
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formCheckboxGroup.vue +0 -86
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formColorPicker.vue +0 -63
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formDatePicker.vue +0 -100
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formDateRangePicker.vue +0 -136
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formImage.vue +0 -278
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formOrgPicker.vue +0 -107
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formRadioGroup.vue +0 -93
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formRate.vue +0 -85
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSelect.vue +0 -138
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSignature.vue +0 -108
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSlider.vue +0 -79
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSwitch.vue +0 -88
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formTimePicker.vue +0 -112
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formTimeRangePicker.vue +0 -155
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formUpload.vue +0 -310
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formUploadTemp.vue +0 -81
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formUserPicker.vue +0 -114
- package/src/components/formGenerator/formComponents/phoneForm.vue +0 -131
- package/src/components/formGenerator/formGenerator.vue +0 -401
- package/src/components/formGenerator/styles/generator.scss +0 -271
- package/src/components/formGenerator/styles/index.scss +0 -136
- package/src/components/formGenerator/styles/left-coms.scss +0 -57
- package/src/components/formGenerator/styles/phone.scss +0 -269
- package/src/components/formGenerator/styles/theme.scss +0 -5
- package/src/components/formGenerator/utils/attribute.js +0 -107
- package/src/components/formGenerator/utils/comMixins.js +0 -148
- package/src/components/formGenerator/utils/component.js +0 -26
- package/src/components/formGenerator/utils/config.js +0 -1642
- package/src/components/formGenerator/utils/event.js +0 -82
- package/src/components/formGenerator/utils/formEvent.js +0 -33
- package/src/components/formGenerator/utils/index.js +0 -665
- package/src/components/formGenerator/utils/rules.js +0 -17
- package/src/components/formGenerator/utils/style.js +0 -75
- package/src/components/formGenerator/utils/table.js +0 -317
- package/src/components/formGenerator/utils/temps.js +0 -13851
- package/src/components/huComponents/FGBreadNav.vue +0 -86
- package/src/components/huComponents/FGCheckCell.vue +0 -107
- package/src/components/huComponents/FGCheckList.vue +0 -318
- package/src/components/huComponents/FGCheckPopUp.vue +0 -164
- package/src/components/huComponents/FGIconsDialog.vue +0 -124
- package/src/components/huComponents/FGNameImg.vue +0 -147
- package/src/components/huComponents/FGOptions.vue +0 -118
- package/src/components/huComponents/FGSelect.vue +0 -46
- package/src/components/huComponents/FGTreeNode.vue +0 -103
- package/src/components/huComponents/FGTreeNodeDialog.vue +0 -89
- package/src/components/huComponents/InputColor.vue +0 -117
- package/src/components/huComponents/InputNumber.vue +0 -78
- package/src/components/huComponents/LayoutTree.vue +0 -67
- package/src/components/huComponents/MenuButton.vue +0 -57
- package/src/components/index.js +0 -14
- package/src/icons/index.js +0 -10
- package/src/icons/svg/active.svg +0 -1
- package/src/icons/svg/addSold.svg +0 -1
- package/src/icons/svg/analyse.svg +0 -1
- package/src/icons/svg/button.svg +0 -1
- package/src/icons/svg/card.svg +0 -1
- package/src/icons/svg/cascader.svg +0 -1
- package/src/icons/svg/checkbox.svg +0 -1
- package/src/icons/svg/collapse.svg +0 -1
- package/src/icons/svg/color.svg +0 -1
- package/src/icons/svg/component.svg +0 -1
- package/src/icons/svg/date-range.svg +0 -1
- package/src/icons/svg/date.svg +0 -1
- package/src/icons/svg/default-dept.svg +0 -9
- package/src/icons/svg/default-role.svg +0 -5
- package/src/icons/svg/default-user.svg +0 -16
- package/src/icons/svg/dept.svg +0 -1
- package/src/icons/svg/divider.svg +0 -1
- package/src/icons/svg/ellipsis.svg +0 -2
- package/src/icons/svg/html.svg +0 -1
- package/src/icons/svg/image.svg +0 -1
- package/src/icons/svg/input.svg +0 -1
- package/src/icons/svg/link.svg +0 -1
- package/src/icons/svg/mp4.svg +0 -19
- package/src/icons/svg/notice.svg +0 -1
- package/src/icons/svg/noview.svg +0 -1
- package/src/icons/svg/number.svg +0 -1
- package/src/icons/svg/password.svg +0 -1
- package/src/icons/svg/pdf.svg +0 -18
- package/src/icons/svg/person.svg +0 -1
- package/src/icons/svg/png.svg +0 -18
- package/src/icons/svg/ppt.svg +0 -19
- package/src/icons/svg/process.svg +0 -1
- package/src/icons/svg/radio.svg +0 -1
- package/src/icons/svg/rate.svg +0 -1
- package/src/icons/svg/remark.svg +0 -1
- package/src/icons/svg/rich-text.svg +0 -1
- package/src/icons/svg/row.svg +0 -1
- package/src/icons/svg/select.svg +0 -1
- package/src/icons/svg/signature.svg +0 -1
- package/src/icons/svg/slider.svg +0 -1
- package/src/icons/svg/steps.svg +0 -1
- package/src/icons/svg/sub.svg +0 -1
- package/src/icons/svg/swipe.svg +0 -1
- package/src/icons/svg/switch.svg +0 -1
- package/src/icons/svg/table-edit.svg +0 -1
- package/src/icons/svg/table.svg +0 -1
- package/src/icons/svg/table2.svg +0 -1
- package/src/icons/svg/table3.svg +0 -1
- package/src/icons/svg/tabs.svg +0 -1
- package/src/icons/svg/tag.svg +0 -1
- package/src/icons/svg/text.svg +0 -1
- package/src/icons/svg/textarea.svg +0 -1
- package/src/icons/svg/time-range.svg +0 -1
- package/src/icons/svg/time.svg +0 -1
- package/src/icons/svg/tree.svg +0 -1
- package/src/icons/svg/unknow.svg +0 -20
- package/src/icons/svg/upload.svg +0 -1
- package/src/icons/svg/view.svg +0 -1
- package/src/icons/svg/word.svg +0 -20
- package/src/icons/svg/xlsx.svg +0 -18
- package/src/icons/svg/zip.svg +0 -20
- package/src/images/phone_bg.png +0 -0
- package/src/main.js +0 -26
- package/src/package/FGDesigner.vue +0 -114
- package/src/package/FGPcForm.vue +0 -100
- package/src/package/FGPcShow.vue +0 -63
- package/src/package/FGPhoneForm.vue +0 -106
- package/src/package/FGPhoneShow.vue +0 -63
- package/src/package/common/init.js +0 -23
- package/src/package/common/initPc.js +0 -26
- package/src/package/common/initPhone.js +0 -28
- package/src/package/common/mixins.js +0 -57
- package/src/package/index.js +0 -40
- package/src/plugins/richEditor/richEditorPc.vue +0 -478
- package/src/plugins/richEditor/richEditorPhone.vue +0 -520
- package/src/plugins/voiceTxtarea/voiceTxtarea.vue +0 -115
- package/src/router.js +0 -111
- package/src/store/index.js +0 -14
- package/src/store/modules/app.js +0 -54
- package/src/store/modules/user.js +0 -23
- package/src/style/color.scss +0 -10
- package/src/style/main.scss +0 -78
- package/src/utils/comsData.js +0 -279
- package/src/utils/defaultValue.js +0 -2165
- package/src/utils/drawingDefalut.js +0 -2749
- package/src/utils/iconData.js +0 -283
- package/src/utils/index.js +0 -6
- package/src/utils/progress.js +0 -96
- package/src/utils/request.js +0 -41
- package/src/views/coms/components/Attributes.vue +0 -28
- package/src/views/coms/components/ELink.vue +0 -23
- package/src/views/coms/components/Events.vue +0 -20
- package/src/views/coms/components/Example.vue +0 -42
- package/src/views/coms/components/Methods.vue +0 -20
- package/src/views/coms/components/VLink.vue +0 -23
- package/src/views/coms/comsDesiger.vue +0 -224
- package/src/views/coms/comsFormPc.vue +0 -76
- package/src/views/coms/comsFormPhone.vue +0 -103
- package/src/views/coms/comsShowPc.vue +0 -51
- package/src/views/coms/comsShowPhone.vue +0 -89
- package/src/views/config/components/configCell.vue +0 -111
- package/src/views/config/config.vue +0 -84
- package/src/views/demo/demo.vue +0 -235
- package/src/views/demo/demo2.vue +0 -131
- package/src/views/demo/table.js +0 -321
- package/src/views/document/index.vue +0 -140
- package/src/views/form/create.vue +0 -44
- package/vue.config.js +0 -72
- /package/{@xfu0401/form-generator/demo.html → demo.html} +0 -0
- /package/{@xfu0401/form-generator/form-generator.common.js → form-generator.common.js} +0 -0
- /package/{@xfu0401/form-generator/form-generator.common.js.map → form-generator.common.js.map} +0 -0
- /package/{@xfu0401/form-generator/form-generator.css → form-generator.css} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.js → form-generator.umd.js} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.js.map → form-generator.umd.js.map} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.min.js → form-generator.umd.min.js} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.min.js.map → form-generator.umd.min.js.map} +0 -0
- /package/{@xfu0401/form-generator/static → static}/fonts/element-icons.535877f5.woff +0 -0
- /package/{@xfu0401/form-generator/static → static}/fonts/element-icons.732389de.ttf +0 -0
- /package/{@xfu0401/form-generator/static → static}/img/phone_bg.7ead1463.png +0 -0
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-menu :default-active="isSelectid" :default-openeds="defaultOpends">
|
|
3
|
-
<div v-for="item in routers" :key="item.path">
|
|
4
|
-
<el-submenu :index="item.path" v-if="item.children && item.children.length">
|
|
5
|
-
<template slot="title">{{ item.meta.title }}</template>
|
|
6
|
-
<el-menu-item
|
|
7
|
-
:index="children.path"
|
|
8
|
-
v-for="children in item.children"
|
|
9
|
-
:key="children.path"
|
|
10
|
-
@click="goPath(children)"
|
|
11
|
-
>
|
|
12
|
-
<i>{{children.meta.title}}</i>
|
|
13
|
-
</el-menu-item>
|
|
14
|
-
</el-submenu>
|
|
15
|
-
<el-menu-item v-else :index="item.path" @click="goPath(item)">{{ item.meta.title }}</el-menu-item>
|
|
16
|
-
</div>
|
|
17
|
-
</el-menu>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
import { constantRouterMap } from "@/router";
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
data() {
|
|
25
|
-
return {
|
|
26
|
-
isSelectid: this.$route.path // 当前页面选中
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
computed: {
|
|
30
|
-
routers() {
|
|
31
|
-
return constantRouterMap.filter(item => item.meta?.title);
|
|
32
|
-
},
|
|
33
|
-
defaultOpends() {
|
|
34
|
-
return this.routers.map(item => item.path);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
methods: {
|
|
39
|
-
goPath(val) {
|
|
40
|
-
this.$router.push({ path: val.path });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<style lang="scss"></style>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg :class="svgClass" aria-hidden="true">
|
|
3
|
-
<use :xlink:href="iconName"/>
|
|
4
|
-
</svg>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
export default {
|
|
9
|
-
name: 'SvgIcon',
|
|
10
|
-
props: {
|
|
11
|
-
iconClass: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
className: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: ''
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
computed: {
|
|
21
|
-
iconName () {
|
|
22
|
-
return `#icon-${this.iconClass}`
|
|
23
|
-
},
|
|
24
|
-
svgClass () {
|
|
25
|
-
if (this.className) {
|
|
26
|
-
return 'svg-icon ' + this.className
|
|
27
|
-
} else {
|
|
28
|
-
return 'svg-icon'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<style scoped>
|
|
36
|
-
.svg-icon {
|
|
37
|
-
width: 1em;
|
|
38
|
-
height: 1em;
|
|
39
|
-
vertical-align: -0.15em;
|
|
40
|
-
fill: currentColor;
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="fg-code">
|
|
3
|
-
<pre :id="id" v-highlight v-if="!loading"><code>{{code}}</code></pre>
|
|
4
|
-
<el-button type="text" @click="handleCopy">{{isCopy?'已复制':'复制'}}</el-button>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
import "highlight.js/styles/atom-one-dark.css"; // 黑色主题
|
|
10
|
-
// import "highlight.js/styles/atom-one-light.css";
|
|
11
|
-
import hljs from "highlight.js/lib/core";
|
|
12
|
-
// 仅包含你需要的语言
|
|
13
|
-
import javascript from "highlight.js/lib/languages/javascript";
|
|
14
|
-
import xml from "highlight.js/lib/languages/xml";
|
|
15
|
-
// 注册语言
|
|
16
|
-
hljs.registerLanguage("javascript", javascript);
|
|
17
|
-
hljs.registerLanguage("xml", xml);
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
props: {
|
|
21
|
-
code: {
|
|
22
|
-
default: ""
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
data() {
|
|
26
|
-
return {
|
|
27
|
-
loading: false,
|
|
28
|
-
isCopy: false,
|
|
29
|
-
id: new Date().getTime().toString()
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
watch: {
|
|
33
|
-
code() {
|
|
34
|
-
this.loading = true;
|
|
35
|
-
this.$nextTick(() => {
|
|
36
|
-
this.loading = false;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
methods: {
|
|
41
|
-
handleCopy() {
|
|
42
|
-
if (this.isCopy) return;
|
|
43
|
-
const codeSnippet = document.getElementById(this.id);
|
|
44
|
-
const selection = window.getSelection();
|
|
45
|
-
const range = document.createRange();
|
|
46
|
-
// 选中需要复制的代码
|
|
47
|
-
range.selectNodeContents(codeSnippet);
|
|
48
|
-
selection.removeAllRanges();
|
|
49
|
-
selection.addRange(range);
|
|
50
|
-
|
|
51
|
-
// 复制到剪贴板
|
|
52
|
-
const successful = document.execCommand("copy");
|
|
53
|
-
if (successful) {
|
|
54
|
-
// this.$message.success("代码复制成功");
|
|
55
|
-
this.isCopy = true;
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
this.isCopy = false;
|
|
58
|
-
clearTimeout();
|
|
59
|
-
}, 3000);
|
|
60
|
-
} else {
|
|
61
|
-
this.$message.error("代码复制失败");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 清除选区
|
|
65
|
-
window.getSelection().removeAllRanges();
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
directives: {
|
|
69
|
-
highlight: el => {
|
|
70
|
-
let blocks = el.querySelectorAll("pre code");
|
|
71
|
-
blocks.forEach(block => {
|
|
72
|
-
hljs.highlightBlock(block);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<style lang="scss" scoped>
|
|
80
|
-
.fg-code {
|
|
81
|
-
position: relative;
|
|
82
|
-
pre {
|
|
83
|
-
margin: 0;
|
|
84
|
-
width: 100%;
|
|
85
|
-
overflow-x: auto;
|
|
86
|
-
border-radius: 8px;
|
|
87
|
-
}
|
|
88
|
-
code {
|
|
89
|
-
font-size: 16px;
|
|
90
|
-
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
|
|
91
|
-
}
|
|
92
|
-
.el-button {
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 0;
|
|
95
|
-
right: 12px;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
</style>
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 版本列表 -->
|
|
3
|
-
<el-dialog
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:visible.sync="visible"
|
|
6
|
-
v-if="visible"
|
|
7
|
-
:close-on-click-modal="false"
|
|
8
|
-
class="Fg-Dialog"
|
|
9
|
-
append-to-body
|
|
10
|
-
:style="{'--height':height,'--footer':footer?'62px':'0px'}"
|
|
11
|
-
>
|
|
12
|
-
<slot></slot>
|
|
13
|
-
<template slot="footer" v-if="footer">
|
|
14
|
-
<slot name="footer">
|
|
15
|
-
<el-button size="small" @click="handleCancel">{{ cancelText }}</el-button>
|
|
16
|
-
<el-button
|
|
17
|
-
size="small"
|
|
18
|
-
:loading="loading"
|
|
19
|
-
type="primary"
|
|
20
|
-
@click="handleConfirm"
|
|
21
|
-
>{{ confirmText}}</el-button>
|
|
22
|
-
</slot>
|
|
23
|
-
</template>
|
|
24
|
-
</el-dialog>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script>
|
|
28
|
-
export default {
|
|
29
|
-
name: "FGDialog",
|
|
30
|
-
props: {
|
|
31
|
-
cancelText: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: "取消",
|
|
34
|
-
},
|
|
35
|
-
confirmText: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: "确认",
|
|
38
|
-
},
|
|
39
|
-
loading: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false,
|
|
42
|
-
},
|
|
43
|
-
footer: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true,
|
|
46
|
-
},
|
|
47
|
-
height: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: "60vh",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
visible: false,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
methods: {
|
|
58
|
-
open() {
|
|
59
|
-
this.visible = true;
|
|
60
|
-
},
|
|
61
|
-
close() {
|
|
62
|
-
this.visible = false;
|
|
63
|
-
},
|
|
64
|
-
handleCancel() {
|
|
65
|
-
this.close();
|
|
66
|
-
this.$emit("cancel");
|
|
67
|
-
},
|
|
68
|
-
handleConfirm() {
|
|
69
|
-
// this.visible = false;
|
|
70
|
-
this.$emit("confirm");
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<style lang="scss" >
|
|
77
|
-
.Fg-Dialog {
|
|
78
|
-
// overflow: hidden !important;
|
|
79
|
-
.el-dialog {
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
// margin-top: calc(
|
|
82
|
-
// (100vh - var(--height) - var(--footer) - 54px) / 2
|
|
83
|
-
// ) !important;
|
|
84
|
-
.el-dialog__body {
|
|
85
|
-
overflow: auto;
|
|
86
|
-
height: var(--height);
|
|
87
|
-
// height: calc(var(--height) - var(--footer) - 54px);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
.is-fullscreen {
|
|
91
|
-
display: flex;
|
|
92
|
-
flex-direction: column;
|
|
93
|
-
height: 100vh;
|
|
94
|
-
.el-dialog__body {
|
|
95
|
-
height: auto;
|
|
96
|
-
flex: 1;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
</style>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FGDialog ref="FGDialog" title="编辑数据" width="900px" top="8vh" @confirm="confirm">
|
|
3
|
-
<CodeEditor
|
|
4
|
-
v-model="code"
|
|
5
|
-
:mode="mode"
|
|
6
|
-
:name="name"
|
|
7
|
-
:params="params"
|
|
8
|
-
:placeholder="placeholder"
|
|
9
|
-
/>
|
|
10
|
-
</FGDialog>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import CodeEditor from "./CodeEditor";
|
|
15
|
-
export default {
|
|
16
|
-
name: "CodeDialog",
|
|
17
|
-
components: {
|
|
18
|
-
CodeEditor,
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
// 表示当前编辑器类型
|
|
22
|
-
mode: {
|
|
23
|
-
type: String,
|
|
24
|
-
// text/javascript js编辑器
|
|
25
|
-
// application/json json编辑器
|
|
26
|
-
// text/html html编辑器
|
|
27
|
-
// text/css css编辑器
|
|
28
|
-
default: "application/json",
|
|
29
|
-
},
|
|
30
|
-
// 方法名
|
|
31
|
-
name: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: "",
|
|
34
|
-
},
|
|
35
|
-
// 参数
|
|
36
|
-
params: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: "",
|
|
39
|
-
},
|
|
40
|
-
placeholder: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: "",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
data() {
|
|
46
|
-
return {
|
|
47
|
-
code: "",
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
methods: {
|
|
51
|
-
open(data) {
|
|
52
|
-
if (data) this.code = data;
|
|
53
|
-
this.$refs.FGDialog.open();
|
|
54
|
-
},
|
|
55
|
-
confirm() {
|
|
56
|
-
this.$emit("input", this.code);
|
|
57
|
-
this.$emit("confirm", this.code);
|
|
58
|
-
this.$refs.FGDialog.close();
|
|
59
|
-
},
|
|
60
|
-
handleCodeChange(code) {
|
|
61
|
-
console.log(code);
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<style lang="scss" >
|
|
68
|
-
</style>
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="Fg-Code-Editor">
|
|
3
|
-
<div v-if="name" class="Fg-Code-Editor-label" v-html="topContent"></div>
|
|
4
|
-
<div class="Fg-Code-Editor-content">
|
|
5
|
-
<codemirror v-model="code" @ready="onCmReady" :style="codemirrorStyle" :options="cmOptions"></codemirror>
|
|
6
|
-
</div>
|
|
7
|
-
<div v-if="name" class="Fg-Code-Editor-label">}</div>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
import { codemirror } from "vue-codemirror"; // 引入组件
|
|
13
|
-
import "codemirror/lib/codemirror.css";
|
|
14
|
-
import "codemirror/theme/base16-dark.css"; // 引入base16-dark主题样式
|
|
15
|
-
import "codemirror/addon/fold/foldgutter.css"; // 代码折叠图标样式
|
|
16
|
-
import "codemirror/addon/fold/foldcode"; // 代码折叠
|
|
17
|
-
import "codemirror/addon/fold/foldgutter"; // 代码折叠图标
|
|
18
|
-
import "codemirror/addon/fold/brace-fold"; // 代码折叠括号
|
|
19
|
-
// 支持代码自动补全
|
|
20
|
-
import "codemirror/addon/hint/show-hint.css";
|
|
21
|
-
import "codemirror/addon/hint/show-hint.js";
|
|
22
|
-
import "codemirror/addon/hint/anyword-hint.js";
|
|
23
|
-
import "codemirror/addon/hint/javascript-hint";
|
|
24
|
-
import "codemirror/addon/hint/css-hint";
|
|
25
|
-
// 高亮显示搜索匹配的结果
|
|
26
|
-
// 搜索功能的依赖
|
|
27
|
-
import "codemirror/addon/dialog/dialog.js";
|
|
28
|
-
import "codemirror/addon/dialog/dialog.css";
|
|
29
|
-
// 支持搜索功能
|
|
30
|
-
import "codemirror/addon/search/search";
|
|
31
|
-
import "codemirror/addon/search/searchcursor.js";
|
|
32
|
-
// 高亮显示匹配的括号
|
|
33
|
-
import "codemirror/addon/edit/matchbrackets";
|
|
34
|
-
// 行注释
|
|
35
|
-
import "codemirror/addon/comment/comment.js";
|
|
36
|
-
// 语言支持
|
|
37
|
-
import "codemirror/mode/css/css.js";
|
|
38
|
-
import "codemirror/mode/javascript/javascript.js";
|
|
39
|
-
import "codemirror/mode/vue/vue.js";
|
|
40
|
-
// 语法检查
|
|
41
|
-
import "codemirror/addon/lint/lint";
|
|
42
|
-
import "codemirror/addon/lint/lint.css";
|
|
43
|
-
import "codemirror/addon/lint/json-lint"; // json语法检查
|
|
44
|
-
import "codemirror/addon/lint/javascript-lint"; // javascript语法检查
|
|
45
|
-
// import "codemirror/addon/lint/html-lint"; // html语法检查
|
|
46
|
-
import "codemirror/addon/lint/css-lint"; // css语法检查
|
|
47
|
-
// window.CSSLint = CSSLint;
|
|
48
|
-
import jsonlint from "jsonlint";
|
|
49
|
-
window.jsonlint = jsonlint;
|
|
50
|
-
import { JSHINT } from "jshint";
|
|
51
|
-
window.JSHINT = JSHINT;
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
name: "CodeEditor",
|
|
55
|
-
components: {
|
|
56
|
-
codemirror,
|
|
57
|
-
},
|
|
58
|
-
props: {
|
|
59
|
-
value: {},
|
|
60
|
-
// 表示当前编辑器类型
|
|
61
|
-
mode: {
|
|
62
|
-
type: String,
|
|
63
|
-
// text/javascript js编辑器
|
|
64
|
-
// application/json json编辑器
|
|
65
|
-
// text/html html编辑器
|
|
66
|
-
// text/css css编辑器
|
|
67
|
-
default: "text/html",
|
|
68
|
-
},
|
|
69
|
-
placeholder: {
|
|
70
|
-
type: String,
|
|
71
|
-
default: "// 你的初始代码",
|
|
72
|
-
},
|
|
73
|
-
// 方法名
|
|
74
|
-
name: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: "",
|
|
77
|
-
},
|
|
78
|
-
// 参数
|
|
79
|
-
params: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: "",
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
data() {
|
|
85
|
-
return {
|
|
86
|
-
code: this.value || this.placeholder,
|
|
87
|
-
cmOptions: {
|
|
88
|
-
mode: this.mode,
|
|
89
|
-
gutters: [
|
|
90
|
-
"CodeMirror-lint-markers",
|
|
91
|
-
"CodeMirror-linenumbers",
|
|
92
|
-
"CodeMirror-foldgutter",
|
|
93
|
-
],
|
|
94
|
-
lineNumbers: true,
|
|
95
|
-
line: true,
|
|
96
|
-
lint: true,
|
|
97
|
-
lineWrapping: true,
|
|
98
|
-
autofocus: true,
|
|
99
|
-
autoCloseBrackets: true,
|
|
100
|
-
foldGutter: true, // 块槽
|
|
101
|
-
hintOptions: { completeSingle: true },
|
|
102
|
-
matchTags: { bothTags: true },
|
|
103
|
-
matchBrackets: true,
|
|
104
|
-
showCursorWhenSelecting: true,
|
|
105
|
-
styleSelectedText: true,
|
|
106
|
-
styleActiveLine: true,
|
|
107
|
-
autoRefresh: true,
|
|
108
|
-
highlightSelectionMatches: {
|
|
109
|
-
minChars: 2,
|
|
110
|
-
trim: true,
|
|
111
|
-
style: "matchhighlight",
|
|
112
|
-
showToken: false,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
codemirrorStyle: {
|
|
116
|
-
fontSize: "18px",
|
|
117
|
-
lineHeight: "150%",
|
|
118
|
-
height: "450px",
|
|
119
|
-
border: "1px solid #EBEEF5",
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
computed: {
|
|
124
|
-
// text/javascript js编辑器
|
|
125
|
-
// application/json json编辑器
|
|
126
|
-
// text/html html编辑器
|
|
127
|
-
// text/css css编辑器
|
|
128
|
-
topContent() {
|
|
129
|
-
return {
|
|
130
|
-
"text/javascript": `<div><span style="color: #708">function</span> <span style="color: #00f">${this.name}</span>(<span style="color: #00f">${this.params}</span>) {</div>`,
|
|
131
|
-
"text/css": `<span style="color: #164;">.${this.name}</span> {`,
|
|
132
|
-
}[this.mode];
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
watch: {
|
|
136
|
-
code() {
|
|
137
|
-
this.$emit("input", this.code);
|
|
138
|
-
this.$emit("change", this.code);
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
methods: {
|
|
142
|
-
onCmReady(cm) {
|
|
143
|
-
// cm.on("inputRead", (cm, obj) => {
|
|
144
|
-
// if (obj.text && obj.text.length > 0) {
|
|
145
|
-
// let c = obj.text[0].charAt(obj.text[0].length - 1);
|
|
146
|
-
// if ((c >= "a" && c <= "z") || (c >= "A" && c <= "Z")) {
|
|
147
|
-
// cm.showHint({ completeSingle: false }); // 自动填充关闭了它
|
|
148
|
-
// }
|
|
149
|
-
// }
|
|
150
|
-
// });
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
</script>
|
|
155
|
-
|
|
156
|
-
<style lang="scss" >
|
|
157
|
-
.Fg-Code-Editor {
|
|
158
|
-
height: 100%;
|
|
159
|
-
display: flex;
|
|
160
|
-
flex-direction: column;
|
|
161
|
-
justify-content: space-between;
|
|
162
|
-
background-color: #f5f5f5;
|
|
163
|
-
.Fg-Code-Editor-label {
|
|
164
|
-
background-color: #f7f7f7;
|
|
165
|
-
font-family: monospace;
|
|
166
|
-
font-size: 18px;
|
|
167
|
-
line-height: 150%;
|
|
168
|
-
margin-left: 57px;
|
|
169
|
-
border-left: 1px solid #ddd;
|
|
170
|
-
padding-left: 5px;
|
|
171
|
-
padding: 5px;
|
|
172
|
-
}
|
|
173
|
-
.Fg-Code-Editor-content {
|
|
174
|
-
height: calc(100% - 76px);
|
|
175
|
-
overflow: auto;
|
|
176
|
-
}
|
|
177
|
-
.vue-codemirror {
|
|
178
|
-
border: none !important;
|
|
179
|
-
height: 100% !important;
|
|
180
|
-
.CodeMirror {
|
|
181
|
-
height: 100% !important;
|
|
182
|
-
}
|
|
183
|
-
.CodeMirror-line {
|
|
184
|
-
padding-left: 27px !important;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
.CodeMirror-hints {
|
|
188
|
-
z-index: 300 !important;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
</style>
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="Fg-code-json">
|
|
3
|
-
<textarea ref="codemirror" />
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
// 引入CodeMirror和基础样式
|
|
10
|
-
import CodeMirror from "codemirror";
|
|
11
|
-
import "codemirror/lib/codemirror.css";
|
|
12
|
-
// JSON代码高亮需要由JavaScript插件支持
|
|
13
|
-
import "codemirror/mode/javascript/javascript.js";
|
|
14
|
-
// 选择IDEA主题样式,还有其他很多主题可选
|
|
15
|
-
import "codemirror/theme/idea.css";
|
|
16
|
-
// 支持使用Sublime快捷键
|
|
17
|
-
import "codemirror/keymap/sublime.js";
|
|
18
|
-
// 搜索功能的依赖
|
|
19
|
-
import "codemirror/addon/dialog/dialog.js";
|
|
20
|
-
import "codemirror/addon/dialog/dialog.css";
|
|
21
|
-
// 支持搜索功能
|
|
22
|
-
import "codemirror/addon/search/search";
|
|
23
|
-
import "codemirror/addon/search/searchcursor.js";
|
|
24
|
-
// 支持各种代码折叠
|
|
25
|
-
import "codemirror/addon/fold/foldgutter.css";
|
|
26
|
-
import "codemirror/addon/fold/foldcode.js";
|
|
27
|
-
import "codemirror/addon/fold/foldgutter.js";
|
|
28
|
-
import "codemirror/addon/fold/brace-fold.js";
|
|
29
|
-
import "codemirror/addon/fold/comment-fold.js";
|
|
30
|
-
// 支持代码区域全屏功能
|
|
31
|
-
import "codemirror/addon/display/fullscreen.css";
|
|
32
|
-
import "codemirror/addon/display/fullscreen.js";
|
|
33
|
-
// 支持括号自动匹配
|
|
34
|
-
import "codemirror/addon/edit/matchbrackets.js";
|
|
35
|
-
import "codemirror/addon/edit/closebrackets.js";
|
|
36
|
-
// 支持代码自动补全
|
|
37
|
-
import "codemirror/addon/hint/show-hint.css";
|
|
38
|
-
import "codemirror/addon/hint/show-hint.js";
|
|
39
|
-
import "codemirror/addon/hint/anyword-hint.js";
|
|
40
|
-
// 行注释
|
|
41
|
-
import "codemirror/addon/comment/comment.js";
|
|
42
|
-
// JSON错误检查
|
|
43
|
-
import "codemirror/addon/lint/lint.css";
|
|
44
|
-
import "codemirror/addon/lint/lint.js";
|
|
45
|
-
// 需要依赖全局的jsonlint,不是很优雅
|
|
46
|
-
import "codemirror/addon/lint/json-lint.js";
|
|
47
|
-
//及时自动更新,配置里面也需要设置autoRefresh为true
|
|
48
|
-
import "codemirror/addon/display/autorefresh";
|
|
49
|
-
// 引入jsonlint
|
|
50
|
-
import jsonlint from "jsonlint";
|
|
51
|
-
window.jsonlint = jsonlint;
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
name: "CodeEditor",
|
|
55
|
-
/* eslint-disable vue/require-prop-types */
|
|
56
|
-
props: {
|
|
57
|
-
value: [String, Number, Object, Array],
|
|
58
|
-
readonly: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
jsonEditor: false,
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
// 监听是否数据改变,随时更新json数据
|
|
69
|
-
watch: {
|
|
70
|
-
value(value) {
|
|
71
|
-
// console.log(value);
|
|
72
|
-
const editorValue = this.jsonEditor.getValue();
|
|
73
|
-
if (value !== editorValue) {
|
|
74
|
-
this.jsonEditor.setValue(JSON.stringify(this.value, null, 2));
|
|
75
|
-
}
|
|
76
|
-
this.jsonEditor.refresh();
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
mounted() {
|
|
80
|
-
// CodeMirror的配置项,搜官网看这里的配置项配置
|
|
81
|
-
this.jsonEditor = CodeMirror.fromTextArea(this.$refs.codemirror, {
|
|
82
|
-
mode: "application/json", // 接受的类型,json xml....
|
|
83
|
-
smartIndent: true, // 是否智能缩进
|
|
84
|
-
styleActiveLine: true, // 当前行高亮
|
|
85
|
-
lineNumbers: true, // 是否显示行数
|
|
86
|
-
indentUnit: 2, // 缩进单位,默认2
|
|
87
|
-
gutters: [
|
|
88
|
-
"CodeMirror-linenumbers",
|
|
89
|
-
"CodeMirror-foldgutter",
|
|
90
|
-
"CodeMirror-lint-markers", // CodeMirror-lint-markers是实现语法报错功能
|
|
91
|
-
],
|
|
92
|
-
lint: true,
|
|
93
|
-
//lineWrapping: true, // 自动换行
|
|
94
|
-
matchBrackets: true, // 括号匹配显示
|
|
95
|
-
autoCloseBrackets: true, // 输入和退格时成对
|
|
96
|
-
readonly: this.readonly, // 只读
|
|
97
|
-
foldGutter: true,
|
|
98
|
-
autoRefresh: true,
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
this.jsonEditor.setValue(JSON.stringify(this.value, null, 2));
|
|
102
|
-
this.jsonEditor.on("change", (cm) => {
|
|
103
|
-
this.$emit("changed", cm.getValue());
|
|
104
|
-
this.$emit("input", cm.getValue());
|
|
105
|
-
// 编辑json框里面的内容可以时刻监听到值,通过cm.getValue()获取到
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
methods: {
|
|
109
|
-
getValue() {
|
|
110
|
-
return this.jsonEditor.getValue();
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
</script>
|
|
115
|
-
|
|
116
|
-
<style scoped>
|
|
117
|
-
.Fg-code-json {
|
|
118
|
-
height: 100%;
|
|
119
|
-
position: relative;
|
|
120
|
-
overflow: auto;
|
|
121
|
-
}
|
|
122
|
-
.Fg-code-json >>> .CodeMirror {
|
|
123
|
-
height: 100%;
|
|
124
|
-
min-height: 300px;
|
|
125
|
-
}
|
|
126
|
-
.Fg-code-json >>> .CodeMirror-scroll {
|
|
127
|
-
height: 100%;
|
|
128
|
-
min-height: 300px;
|
|
129
|
-
}
|
|
130
|
-
</style>
|