Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 7915aae

Browse files
committed
Optimize json editor
1 parent 90b1fef commit 7915aae

File tree

8 files changed

+53
-43
lines changed

8 files changed

+53
-43
lines changed

src/components/contentDetail/index.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ const genRandomAceID = async () => {
5656
}
5757
const initAceEditor = async () => {
5858
aceState.aceEditor = ace.edit(`ace${aceID.value}`, {
59-
maxLines: 40, // 最大行数,超过会自动出现滚动条
60-
minLines: 20, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
61-
fontSize: 14, // 编辑器内字体大小
62-
theme: aceState.themePath, // 默认设置的主题
63-
mode: aceState.modePath, // 默认设置的语言模式
64-
tabSize: 4 // 制表符设置为 4 个空格大小
59+
maxLines: 35,
60+
minLines: 35,
61+
fontSize: 14,
62+
theme: aceState.themePath,
63+
mode: aceState.modePath,
64+
tabSize: 4,
65+
showPrintMargin: false
6566
})
6667
aceState.aceEditor.setReadOnly(props.isReadOnly || false)
6768
}

src/components/customAce/index.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<script setup lang="ts">
88
import ace from 'ace-builds'
99
import 'ace-builds/webpack-resolver' // 在 webpack 环境中使用必须要导入
10-
import 'ace-builds/src-noconflict/theme-gruvbox' // 默认设置的主题
10+
import 'ace-builds/src-noconflict/theme-gruvbox'
1111
import { onMounted, reactive } from 'vue'
1212
1313
const state: { aceEditor: any, themePath: string } = reactive({
@@ -16,12 +16,12 @@ const state: { aceEditor: any, themePath: string } = reactive({
1616
})
1717
onMounted(() => {
1818
state.aceEditor = ace.edit('ace', {
19-
maxLines: 20, // 最大行数,超过会自动出现滚动条
20-
minLines: 20, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
21-
fontSize: 14, // 编辑器内字体大小
22-
theme: state.themePath, // 默认设置的主题
23-
// mode: state.modePath, // 默认设置的语言模式
24-
tabSize: 4 // 制表符设置为 4 个空格大小
19+
maxLines: 20,
20+
minLines: 20,
21+
fontSize: 14,
22+
theme: state.themePath,
23+
tabSize: 4,
24+
showPrintMargin: false
2525
})
2626
})
2727
</script>

src/views/consolePane/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ const genRandomAceID = async () => {
217217
onMounted(async () => {
218218
await genRandomAceID()
219219
state.aceEditor = ace.edit(`ace${aceID.value}`, {
220-
maxLines: 15, // 最大行数,超过会自动出现滚动条
221-
minLines: 15, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
222-
fontSize: 14, // 编辑器内字体大小
223-
theme: state.themePath, // 默认设置的主题
224-
// mode: state.modePath, // 默认设置的语言模式
225-
tabSize: 4 // 制表符设置为 4 个空格大小
220+
maxLines: 15,
221+
minLines: 15,
222+
fontSize: 14,
223+
theme: state.themePath,
224+
tabSize: 4,
225+
showPrintMargin: false
226226
})
227227
})
228228
</script>

src/views/monitor/chart.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ const handleOptions = async () => {
7171
data: props.data.y,
7272
type: 'line',
7373
smooth: true,
74+
lineStyle: {
75+
width: 2,
76+
shadowColor: 'rgba(168,167,167,0.4)',
77+
shadowBlur: 4
78+
},
7479
showSymbol: false
7580
}
7681
]

src/views/monitor/chartWithTwoLine.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,24 @@ const handleOption = async () => {
7272
type: 'line',
7373
smooth: true,
7474
showSymbol: false,
75-
name: props.data.nameList.y
75+
name: props.data.nameList.y,
76+
lineStyle: {
77+
width: 2,
78+
shadowColor: 'rgba(168,167,167,0.4)',
79+
shadowBlur: 4
80+
}
7681
},
7782
{
7883
data: props.data.yList.y2,
7984
type: 'line',
8085
smooth: true,
8186
showSymbol: false,
82-
name: props.data.nameList.y2
87+
name: props.data.nameList.y2,
88+
lineStyle: {
89+
width: 2,
90+
shadowColor: 'rgba(168,167,167,0.4)',
91+
shadowBlur: 4
92+
}
8393
}
8494
]
8595
}

src/views/newKeyValue/index.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,3 @@ const handleFinishEvent = async () => {
126126
}
127127
}
128128
</script>
129-
130-
<style>
131-
.el-button {
132-
display: flex;
133-
flex-direction: row;
134-
align-items: center;
135-
}
136-
</style>

src/views/newKeyValue/stringType.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</div>
2929

3030
<!--textarea-->
31-
<el-input v-model="state.val" :rows="20" type="textarea" v-show="editorModeState.mode === 'text'"/>
31+
<el-input v-model="state.val" :rows="37" type="textarea" resize="none" v-show="editorModeState.mode === 'text'" />
3232

3333
<!--ace-->
3434
<div :id="`ace${aceID}`" v-show="editorModeState.mode === 'json'"/>
@@ -110,12 +110,13 @@ const genRandomAceID = async () => {
110110
}
111111
const initAceEditor = async () => {
112112
aceState.aceEditor = ace.edit(`ace${aceID.value}`, {
113-
maxLines: 45, // 最大行数,超过会自动出现滚动条
114-
minLines: 40, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
115-
fontSize: 14, // 编辑器内字体大小
116-
theme: aceState.themePath, // 默认设置的主题
117-
mode: aceState.modePath, // 默认设置的语言模式
118-
tabSize: 4 // 制表符设置为 4 个空格大小
113+
maxLines: 42,
114+
minLines: 42,
115+
fontSize: 14,
116+
theme: aceState.themePath,
117+
mode: aceState.modePath,
118+
tabSize: 4,
119+
showPrintMargin: false
119120
})
120121
}
121122

src/views/valueContent/stringType.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</div>
3737

3838
<!--textarea-->
39-
<el-input v-model="state.val" :rows="30" type="textarea"
39+
<el-input v-model="state.val" :rows="37" type="textarea" resize="none"
4040
v-show="editorModeState.mode === 'text'"
4141
@click.left.meta.exact="copyKey(state.val, t('valueContent.notification.copySuccessMessage'))"
4242
@click.left.ctrl.exact="copyKey(state.val, t('valueContent.notification.copySuccessMessage'))"
@@ -141,12 +141,13 @@ const genRandomAceID = async () => {
141141
}
142142
const initAceEditor = async () => {
143143
aceState.aceEditor = ace.edit(`ace${aceID.value}`, {
144-
maxLines: 45, // 最大行数,超过会自动出现滚动条
145-
minLines: 40, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
146-
fontSize: 14, // 编辑器内字体大小
147-
theme: aceState.themePath, // 默认设置的主题
148-
mode: aceState.modePath, // 默认设置的语言模式
149-
tabSize: 4 // 制表符设置为 4 个空格大小
144+
maxLines: 42,
145+
minLines: 42,
146+
fontSize: 14,
147+
theme: aceState.themePath,
148+
mode: aceState.modePath,
149+
tabSize: 4,
150+
showPrintMargin: false
150151
})
151152
}
152153
const handleAceUpdate = (message: string) => {

0 commit comments

Comments
 (0)