mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-04 13:29:13 -04:00
fix
This commit is contained in:
parent
bb1f87292f
commit
b34cc75d4f
1 changed files with 8 additions and 7 deletions
|
@ -1,15 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import JSON5 from 'json5';
|
import JSON5 from 'json5';
|
||||||
|
import stringifyObject from 'stringify-object';
|
||||||
import type { UseValidationRule } from '@/composable/validation';
|
import type { UseValidationRule } from '@/composable/validation';
|
||||||
import { isNotThrowing } from '@/utils/boolean';
|
import { isNotThrowing } from '@/utils/boolean';
|
||||||
import { withDefaultOnError } from '@/utils/defaults';
|
import { withDefaultOnError } from '@/utils/defaults';
|
||||||
import stringifyObject from "stringify-object"
|
|
||||||
|
|
||||||
const transformer = (value: string) => withDefaultOnError(() => stringifyObject(JSON5.parse(value), {
|
|
||||||
indent: ' ',
|
|
||||||
singleQuotes: false
|
|
||||||
}), '');
|
|
||||||
|
|
||||||
|
function transformer(value: string) {
|
||||||
|
return withDefaultOnError(() => stringifyObject(JSON5.parse(value), {
|
||||||
|
indent: ' ',
|
||||||
|
singleQuotes: false,
|
||||||
|
}), '');
|
||||||
|
}
|
||||||
|
|
||||||
const rules: UseValidationRule<string>[] = [
|
const rules: UseValidationRule<string>[] = [
|
||||||
{
|
{
|
||||||
|
@ -28,4 +29,4 @@ const rules: UseValidationRule<string>[] = [
|
||||||
:input-validation-rules="rules"
|
:input-validation-rules="rules"
|
||||||
:transformer="transformer"
|
:transformer="transformer"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue