Commit 1bf8d245f0c064276cadaa6e6bb4738a606be644

Authored by fengtao
1 parent 0ad7666c

pref:优化命令下发 命令内容 格式化json

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 <template #commandSlot> 5 <template #commandSlot>
6 <div class="flex"> 6 <div class="flex">
7 <div ref="jsoneditorRef" style="height: 100%; width: 100%"></div> 7 <div ref="jsoneditorRef" style="height: 100%; width: 100%"></div>
  8 + <a-button style="margin: -5px 0" type="text" @click="handlePremitter">格式化</a-button>
8 <Tooltip title='{"method":"methodThingskit","params":{"pin":7,"value":1}}' class="ml-2"> 9 <Tooltip title='{"method":"methodThingskit","params":{"pin":7,"value":1}}' class="ml-2">
9 <QuestionCircleOutlined style="font-size: 1rem" /> 10 <QuestionCircleOutlined style="font-size: 1rem" />
10 </Tooltip> 11 </Tooltip>
@@ -77,7 +78,11 @@ @@ -77,7 +78,11 @@
77 jsonInstance.value = editor; 78 jsonInstance.value = editor;
78 }); 79 });
79 }); 80 });
80 - 81 + const handlePremitter = () => {
  82 + const value = unref(jsonInstance).get();
  83 + if (!value) return;
  84 + return unref(jsonInstance).set(value);
  85 + };
81 const handleCancel = () => { 86 const handleCancel = () => {
82 resetFields(); 87 resetFields();
83 unref(jsonInstance).set({}); 88 unref(jsonInstance).set({});
@@ -135,6 +140,7 @@ @@ -135,6 +140,7 @@
135 jsoneditorRef, 140 jsoneditorRef,
136 jsonValue, 141 jsonValue,
137 jsonInstance, 142 jsonInstance,
  143 + handlePremitter,
138 }; 144 };
139 }, 145 },
140 }); 146 });