|
|
@@ -1,20 +1,18 @@
|
|
|
<template>
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :span="10"><el-input v-model="bodyStr" :rows="2" type="textarea" placeholder="Please input" /></el-col>
|
|
|
- <el-col :span="4"><el-button type="primary">Primary</el-button></el-col>
|
|
|
+ <el-row :gutter="20" class="distribute-box">
|
|
|
<el-col :span="10">
|
|
|
- <pre style="border: 1px solid #42b883aa">{{ bodyJson }}</pre>
|
|
|
- <pre style="border: 1px solid #42b883aa">{{ resultStr }}</pre>
|
|
|
+ <el-input v-model="bodyStr" :rows="2" type="textarea" placeholder="Please input" />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="2" style="display: flex; align-content: center; justify-content: center; align-items: center">
|
|
|
+ <el-button type="primary">发送请求</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <div class="distribute-show">
|
|
|
+ <pre style="border: 1px solid #42b883aa">{{ bodyJson }}</pre>
|
|
|
+ <pre style="border: 1px solid #42b883aa">{{ resultStr }}</pre>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <div class="distribute-box">
|
|
|
- <div><el-input v-model="bodyStr" :rows="2" type="textarea" placeholder="Please input" /></div>
|
|
|
- <div><el-button type="primary">Primary</el-button></div>
|
|
|
- <div>
|
|
|
- <pre style="border: 1px solid #42b883aa">{{ bodyJson }}</pre>
|
|
|
- <pre style="border: 1px solid #42b883aa">{{ resultStr }}</pre>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
const pops = defineProps({
|
|
|
@@ -29,35 +27,47 @@ const pops = defineProps({
|
|
|
default: {},
|
|
|
},
|
|
|
});
|
|
|
-const bodyStr = ref(JSON.stringify(pops.body));
|
|
|
-const resultStr = ref("");
|
|
|
+const bodyStr = ref<string>(JSON.stringify(pops.body));
|
|
|
+const resultStr = ref<string>("");
|
|
|
const bodyJson = computed(() => {
|
|
|
try {
|
|
|
- return JSON.parse(bodyStr);
|
|
|
+ return { ...JSON.parse(bodyStr.value), ...{ instanceId: "instanceId-" + randomString(10) } };
|
|
|
} catch (error) {
|
|
|
- console.log(error);
|
|
|
- return "不是Json格式,请检查!!!";
|
|
|
+ return "不是Json格式,请检查!!!";
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+function randomString(e: Number): String {
|
|
|
+ e = e || 16;
|
|
|
+ let t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678-_";
|
|
|
+ let a = t.length;
|
|
|
+ let n = "";
|
|
|
+ for (let i: Number = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a));
|
|
|
+ return n;
|
|
|
+}
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.distribute-box {
|
|
|
height: 100%;
|
|
|
+ padding: 20px;
|
|
|
border: 1px solid #9c8b8b57;
|
|
|
border-radius: 6px;
|
|
|
- // display: flex;
|
|
|
- // flex-direction: row;
|
|
|
- // justify-content: center;
|
|
|
- // align-items: center;
|
|
|
- // padding: 20px;
|
|
|
- // > div {
|
|
|
- // height: 100%;
|
|
|
- // }
|
|
|
- // :first-child {
|
|
|
- // flex: 1;
|
|
|
- // }
|
|
|
- // :last-child {
|
|
|
- // flex: 1;
|
|
|
- // }
|
|
|
+ .el-textarea {
|
|
|
+ height: 100%;
|
|
|
+ :deep(.el-textarea__inner) {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .distribute-show {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ :first-child {
|
|
|
+ flex: 2;
|
|
|
+ }
|
|
|
+ :last-child {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|