wupengfei
2025-09-25 93c5273910225ae370e576460ee49cac171cc2ea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<template>
  <ProDialog title="查看" v-model="visible" destroy-on-close draggable>
    <json-viewer
      :copyable="true"
      :boxed="true"
      :preview-mode="true"
      :value="form.json"
      expanded
    ></json-viewer>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="emit('onCancel')">取 消</el-button>
        <el-button type="primary" @click="handleConfirm">确 定</el-button>
      </span>
    </template>
  </ProDialog>
</template>
 
<script setup lang="ts">
import { ProDialog } from '@bole-core/components';
import JsonViewer from 'vue-json-viewer';
 
defineOptions({
  name: 'JsonViewerDialog',
});
 
// type Props = {};
 
// const props = withDefaults(defineProps<Props>(), {});
 
const visible = defineModel({ type: Boolean });
 
type Form = {
  title?: string;
  json: object;
};
 
const form = defineModel<Form>('form');
 
const emit = defineEmits<{
  (e: 'onConfirm'): void;
  (e: 'onCancel'): void;
}>();
 
function handleConfirm() {
  emit('onConfirm');
}
</script>