mirror of
https://github.com/fugary/simple-element-plus-template.git
synced 2026-02-22 22:27:00 +00:00
opt: 优化编辑器、charts等页面主题样式
This commit is contained in:
@@ -567,4 +567,36 @@ body,
|
|||||||
|
|
||||||
.dark::view-transition-new(root) {
|
.dark::view-transition-new(root) {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 整体编辑器区域 */
|
||||||
|
.monaco-editor.vs {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gutter(行号区) */
|
||||||
|
.monaco-editor.vs .margin {
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
box-shadow: inset -1px 0 0 #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容区 */
|
||||||
|
.monaco-editor.vs .monaco-editor-background {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark Mode Editor Contrast */
|
||||||
|
.dark .monaco-editor.vs-dark {
|
||||||
|
background-color: var(--el-bg-color);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .monaco-editor.vs-dark .margin {
|
||||||
|
background-color: #252526 !important;
|
||||||
|
box-shadow: inset -1px 0 0 #424242;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .monaco-editor.vs-dark .monaco-editor-background {
|
||||||
|
background-color: #1e1e1e !important;
|
||||||
}
|
}
|
||||||
1
src/vendors/monaco-editor.js
vendored
1
src/vendors/monaco-editor.js
vendored
@@ -17,7 +17,6 @@ const defaultConfig = {
|
|||||||
automaticLayout: true,
|
automaticLayout: true,
|
||||||
autoIndent: 'full',
|
autoIndent: 'full',
|
||||||
scrollBeyondLastLine: false,
|
scrollBeyondLastLine: false,
|
||||||
theme: 'vs-dark',
|
|
||||||
wordWrap: 'on',
|
wordWrap: 'on',
|
||||||
readOnly: true
|
readOnly: true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ const chartConfig = {
|
|||||||
<v-chart
|
<v-chart
|
||||||
v-if="chartConfig"
|
v-if="chartConfig"
|
||||||
class="chart"
|
class="chart"
|
||||||
|
:key="theme"
|
||||||
:theme="theme"
|
:theme="theme"
|
||||||
:option="chartConfig"
|
:option="chartConfig"
|
||||||
autoresize
|
autoresize
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { useMonacoEditorOptions } from '@/vendors/monaco-editor'
|
import { useMonacoEditorOptions } from '@/vendors/monaco-editor'
|
||||||
import { $copyText } from '@/utils'
|
import { $copyText } from '@/utils'
|
||||||
|
import { useGlobalConfigStore } from '@/stores/GlobalConfigStore'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const globalConfigStore = useGlobalConfigStore()
|
||||||
const { contentRef, languageRef, editorRef, monacoEditorOptions, formatDocument } = useMonacoEditorOptions({
|
const { contentRef, languageRef, editorRef, monacoEditorOptions, formatDocument } = useMonacoEditorOptions({
|
||||||
readOnly: false
|
readOnly: false
|
||||||
})
|
})
|
||||||
|
const theme = computed(() => {
|
||||||
|
return globalConfigStore.isDarkTheme ? 'vs-dark' : 'vs'
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -13,6 +21,7 @@ const { contentRef, languageRef, editorRef, monacoEditorOptions, formatDocument
|
|||||||
:language="languageRef"
|
:language="languageRef"
|
||||||
height="400px"
|
height="400px"
|
||||||
:options="monacoEditorOptions"
|
:options="monacoEditorOptions"
|
||||||
|
:theme="theme"
|
||||||
@mount="editorRef=$event"
|
@mount="editorRef=$event"
|
||||||
/>
|
/>
|
||||||
<el-footer
|
<el-footer
|
||||||
|
|||||||
Reference in New Issue
Block a user