feat: json-preview组件

This commit is contained in:
dap 2024-09-09 11:16:38 +08:00
parent b3d00730e9
commit 7fa27837d2
5 changed files with 387 additions and 333 deletions

View File

@ -52,6 +52,7 @@
"pinia": "2.2.2",
"tinymce": "^7.3.0",
"vue": "^3.5.3",
"vue-json-pretty": "^2.4.0",
"vue-router": "^4.4.3"
},
"devDependencies": {

View File

@ -0,0 +1,5 @@
import { withInstall } from '#/utils';
import jsonPreview from './src/json-preview/json-preview.vue';
export const JsonPreview = withInstall(jsonPreview);

View File

@ -0,0 +1,19 @@
<script lang="ts" setup>
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
defineProps<{ data: any }>();
</script>
<template>
<VueJsonPretty :data="data" :deep="3" :show-length="true" path="res" />
</template>
<style lang="less">
html[class='dark'] {
.vjs-tree-node:hover {
background-color: #333;
}
}
</style>

View File

@ -1,9 +1,24 @@
<script setup lang="ts">
import CommonSkeleton from '#/views/common';
import { Page } from '@vben/common-ui';
import { Card } from 'ant-design-vue';
import { JsonPreview } from '#/components/code-editor';
const obj = {
address: {
a: 1,
b: true,
},
age: 1234,
name: 'ruoyi-plus',
};
</script>
<template>
<div>
<CommonSkeleton />
</div>
<Page>
<Card title="json预览">
<JsonPreview :data="obj" />
</Card>
</Page>
</template>

File diff suppressed because it is too large Load Diff