mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-23 23:39:47 +08:00
Merge branch 'dev' of https://gitee.com/xlsea/ruoyi-plus-soybean into flow
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import hljs from 'highlight.js/lib/core';
|
import hljs from 'highlight.js/lib/core';
|
||||||
import json from 'highlight.js/lib/languages/json';
|
import json from 'highlight.js/lib/languages/json';
|
||||||
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
hljs.registerLanguage('json', json);
|
hljs.registerLanguage('json', json);
|
||||||
|
|
||||||
@ -10,15 +11,19 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
class?: string;
|
||||||
code?: string;
|
code?: string;
|
||||||
showLineNumbers?: boolean;
|
showLineNumbers?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
class: '',
|
||||||
code: '',
|
code: '',
|
||||||
showLineNumbers: false
|
showLineNumbers: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const DEFAULT_CLASS = 'max-h-500px';
|
||||||
|
|
||||||
/** 格式化JSON数据 */
|
/** 格式化JSON数据 */
|
||||||
const jsonData = computed<string>(() => {
|
const jsonData = computed<string>(() => {
|
||||||
if (!props.code) return '';
|
if (!props.code) return '';
|
||||||
@ -33,9 +38,9 @@ const jsonData = computed<string>(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="json-preview">
|
<NScrollbar :class="twMerge(DEFAULT_CLASS, props.class)">
|
||||||
<NCode :code="jsonData" :hljs="hljs" language="json" :show-line-numbers="showLineNumbers" />
|
<NCode :code="jsonData" :hljs="hljs" language="json" :show-line-numbers="showLineNumbers" :word-wrap="true" />
|
||||||
</div>
|
</NScrollbar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@ -44,18 +49,4 @@ html[class='dark'] {
|
|||||||
background-color: #7c7777;
|
background-color: #7c7777;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.json-preview {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 500px;
|
|
||||||
overflow-y: auto;
|
|
||||||
@include scrollbar();
|
|
||||||
.empty-data {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100%;
|
|
||||||
color: #999;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -33,7 +33,7 @@ const toGitee = () => {
|
|||||||
</NBadge>
|
</NBadge>
|
||||||
</NButton>
|
</NButton>
|
||||||
</template>
|
</template>
|
||||||
消息
|
{{ $t('page.home.message') }}
|
||||||
</NTooltip>
|
</NTooltip>
|
||||||
</template>
|
</template>
|
||||||
<NCard
|
<NCard
|
||||||
|
@ -6,6 +6,7 @@ html,
|
|||||||
body,
|
body,
|
||||||
#app {
|
#app {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
|
Reference in New Issue
Block a user