mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-25 01:06:15 -04:00
refactor(ui): replaced some n-input to c-input (#505)
This commit is contained in:
parent
5c3bebfe62
commit
05ea545475
20 changed files with 189 additions and 235 deletions
|
@ -66,11 +66,14 @@ const validation = useValidation({
|
|||
mb-2
|
||||
/>
|
||||
|
||||
<c-input-text v-model:value="valueLong" multiline autosize mb-2 rows="5" />
|
||||
|
||||
<c-input-text
|
||||
value="Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum, est modi iusto repellendus fuga accusantium atque at magnam aliquam eum explicabo vero quia, nobis quasi quis! Earum amet quam a?"
|
||||
multiline
|
||||
clearable
|
||||
/>
|
||||
|
||||
<h2>Autosize</h2>
|
||||
|
||||
<c-input-text v-model:value="value" label="Autosize" rows="1" multiline autosize mb-2 />
|
||||
<c-input-text v-model:value="valueLong" label="Autosize monospace" rows="1" multiline autosize monospace mb-2 />
|
||||
</template>
|
||||
|
|
|
@ -82,12 +82,12 @@ const inputRef = ref<HTMLInputElement>();
|
|||
const inputWrapperRef = ref<HTMLElement>();
|
||||
|
||||
watch(
|
||||
value,
|
||||
() => {
|
||||
[value, autosize, multiline, inputWrapperRef, textareaRef],
|
||||
() => nextTick(() => {
|
||||
if (props.multiline && autosize.value) {
|
||||
resizeTextarea();
|
||||
}
|
||||
},
|
||||
}),
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
|
@ -96,9 +96,9 @@ function resizeTextarea() {
|
|||
return;
|
||||
}
|
||||
|
||||
const { scrollHeight } = textareaRef.value;
|
||||
const scrollHeight = textareaRef.value.scrollHeight + 2;
|
||||
|
||||
inputWrapperRef.value.style.height = `${scrollHeight + 2}px`;
|
||||
inputWrapperRef.value.style.height = `${scrollHeight}px`;
|
||||
}
|
||||
|
||||
const htmlInputType = computed(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue