fix: 更新
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2025-08-31 09:20:42 +08:00
parent e947e002ba
commit f87e623a84

View File

@@ -1,9 +1,11 @@
<script lang="ts" setup>
import type { JsonViewerAction, JsonViewerValue } from '@vben/common-ui';
import { computed, ref } from 'vue';
import { Page } from '@vben/common-ui';
import { JsonViewer, Page } from '@vben/common-ui';
import { Button, Input, Select, Switch, Table } from 'ant-design-vue';
import { Button, Input, message, Select, Switch, Table } from 'ant-design-vue';
import filedType from '#/util/json/filedType.json';
import formType from '#/util/json/formType.json';
@@ -67,11 +69,39 @@ const columns = computed(() => [
fixed: 'right',
},
]);
function handleKeyClick(key: string) {
message.info(`点击了Key ${key}`);
}
function handleValueClick(value: JsonViewerValue) {
message.info(`点击了Value ${JSON.stringify(value)}`);
}
function handleCopied(_event: JsonViewerAction) {
message.success('已复制JSON');
}
const jsonValue = ref('');
const changeJsonValue = () => {
tableData.value = JSON.parse(jsonValue.value);
};
</script>
<template>
<Page auto-content-height>
{{ tableData }}
<Input v-model:value="jsonValue" />
<Button @click="changeJsonValue">写入json</Button>
<JsonViewer
:value="tableData"
:expand-depth="3"
copyable
:sort="false"
@key-click="handleKeyClick"
@value-click="handleValueClick"
@copied="handleCopied"
boxed
/>
<Table
:columns="columns"
:data-source="tableData"
@@ -122,7 +152,7 @@ const columns = computed(() => [
<!-- 基础配置 -->
<template v-if="column.dataIndex === 'base'">
<!-- 开关控件 -->
<div>可以为空 <Switch v-model:checked="record.null" /></div>
<div>不能为空 <Switch v-model:checked="record.not_null" /></div>
<div class="mt-2">
表单显示 <Switch v-model:checked="record.formShow" />
</div>