2 changed files with 35 additions and 0 deletions
@ -0,0 +1 @@
|
||||
export { default } from './src/index.vue' |
@ -0,0 +1,34 @@
|
||||
<script setup lang="ts"> |
||||
import { computed, ref } from 'vue' |
||||
import { Modal } from 'ant-design-vue' |
||||
import { JsonPreview } from '@/components/CodeEditor' |
||||
|
||||
const modalProps = withDefaults(defineProps<{ |
||||
title?: string |
||||
width?: string |
||||
data: string |
||||
}>(), { width: '50%' }) |
||||
|
||||
const open = ref(false) |
||||
|
||||
const jsonData = computed(() => { |
||||
try { |
||||
return JSON.parse(modalProps.data) |
||||
} |
||||
catch { |
||||
return {} |
||||
} |
||||
}) |
||||
</script> |
||||
|
||||
<template> |
||||
<div @click="open = true"> |
||||
<slot /> |
||||
</div> |
||||
|
||||
<Modal v-bind="modalProps" v-model:open="open" :footer="null"> |
||||
<div p="20px" border-rounded bg-gray-50> |
||||
<JsonPreview :data="jsonData" /> |
||||
</div> |
||||
</Modal> |
||||
</template> |
Loading…
Reference in new issue