提交 83c1683b 编写于 作者: 无木

feat(demo): add `JsonPreview` demo

添加JsonPreview组件的使用演示

close: #1146
上级 044e2e4e
......@@ -14,8 +14,8 @@
</PageWrapper>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { CodeEditor } from '/@/components/CodeEditor';
import { defineComponent, ref, unref, h } from 'vue';
import { CodeEditor, JsonPreview } from '/@/components/CodeEditor';
import { PageWrapper } from '/@/components/Page';
import { Radio, Space, Modal } from 'ant-design-vue';
......@@ -82,7 +82,14 @@
}
function showData() {
Modal.info({ title: '编辑器当前值', content: value.value });
if (unref(modeValue) === 'application/json') {
Modal.info({
title: '编辑器当前值',
content: h(JsonPreview, { data: JSON.parse(value.value) }),
});
} else {
Modal.info({ title: '编辑器当前值', content: value.value });
}
}
return { value, modeValue, handleModeChange, showData };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册