Browse Source

添加JSON拷贝功能

master
zhaohe 7 months ago
parent
commit
b781d1c4b2
  1. 24
      src/components/ServiceConfigurationActionLog.vue

24
src/components/ServiceConfigurationActionLog.vue

@ -12,9 +12,14 @@
</div>
<a-modal v-model:open="reultDisplay" title="结果" @ok="reultDisplay = false" :closable="false">
<div class="border rounded p-3 whitespace-pre bg-white mb-3 grow" style="max-height: 80vh; overflow-y: auto;">
<vue-json-pretty :data="resultContent" :deep="5" :show-double-quotes="false" :show-key-value-space="false"
:show-icon="true" :item-height="18"></vue-json-pretty>
<div style="max-height: 80vh; overflow-y: auto;">
<!-- <a-button type="primary" @click="copyToClipboard">COPY</a-button> -->
<CopyOutlined @click="copyToClipboard" />
<vue-json-pretty copyable :data="resultContent" :deep="5" :show-double-quotes="false"
:show-key-value-space="false" :show-icon="true" :item-height="18">
</vue-json-pretty>
</div>
</a-modal>
@ -22,8 +27,9 @@
<div ref="chartContainer" class="w-full bg-white mb-3 border rounded" style="height:600px;"></div>
</a-modal>
<a-modal v-model:open="tableDisEnable" title="表单" width="90%" @ok="tableDisEnable = false">
<a-table :pagination=false :scroll="{ x: 3000, y: '50vh' }" :expand-column-width="100" :columns="columns" :data-source="tableData" />
<a-modal v-model:open="tableDisEnable" title="表单" width="90%" @ok="tableDisEnable = false">
<a-table :pagination=false :size="small" :scroll="{ x: 'max-content', y: '50vh' }" :expand-column-width="100"
:columns="columns" :data-source="tableData" />
</a-modal>
</div>
@ -33,6 +39,8 @@ import * as echarts from 'echarts';
import { ref, nextTick, watch } from 'vue';
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
import { message } from 'ant-design-vue';
import { CopyOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
/** @var {Object} */
const props = defineProps({
log: Object,
@ -163,4 +171,10 @@ async function handleLogChange() {
reultDisplay.value = true;
}
}
function copyToClipboard() {
message.info('已经拷贝');
console.log("已经拷贝");
navigator.clipboard.writeText(JSON.stringify(resultContent.value, null, 2));
}
</script>
Loading…
Cancel
Save