mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 23:00:19 +03:00
feat(new tool): Javascript Prettier
Javascript Prettier
This commit is contained in:
1 parent
7616a35c41
commit
d1d2b6b36d
7 files changed
+241
-18
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import beautify from 'js-beautify';
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
|
||||
const inputJS = ref('');
|
||||
const outputJS = computed(() => {
|
||||
return beautify(inputJS.value, {
|
||||
indent_char: ' ',
|
||||
indent_size: 2,
|
||||
eol: '\n',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="inputJS"
|
||||
multiline raw-text
|
||||
placeholder="Your JS content..."
|
||||
rows="8"
|
||||
autofocus
|
||||
label="Your JS to format (can paste from clipboard):"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="Output prettified JS:">
|
||||
<TextareaCopyable
|
||||
:value="outputJS"
|
||||
multiline
|
||||
language="javascript"
|
||||
word-wrap
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user