Showing
1 changed file
with
7 additions
and
1 deletions
... | ... | @@ -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 | }); | ... | ... |