Commit 1bf8d245f0c064276cadaa6e6bb4738a606be644

Authored by fengtao
1 parent 0ad7666c

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

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