mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #3802 - Improve folder structure for nuxt configurations
This commit is contained in:
parent
851950270b
commit
f5fe822afb
563 changed files with 1703 additions and 1095 deletions
62
components/lib/textarea/Textarea.vue
Executable file
62
components/lib/textarea/Textarea.vue
Executable file
|
@ -0,0 +1,62 @@
|
|||
<template>
|
||||
<textarea :class="['p-inputtextarea p-inputtext p-component', { 'p-filled': filled, 'p-inputtextarea-resizable ': autoResize }]" :value="modelValue" @input="onInput"></textarea>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Textarea',
|
||||
emits: ['update:modelValue'],
|
||||
props: {
|
||||
modelValue: null,
|
||||
autoResize: Boolean
|
||||
},
|
||||
mounted() {
|
||||
if (this.$el.offsetParent && this.autoResize) {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
updated() {
|
||||
if (this.$el.offsetParent && this.autoResize) {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resize() {
|
||||
const style = window.getComputedStyle(this.$el);
|
||||
|
||||
this.$el.style.height = 'auto';
|
||||
this.$el.style.height = `calc(${style.borderTopWidth} + ${style.borderBottomWidth} + ${this.$el.scrollHeight}px)`;
|
||||
|
||||
if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) {
|
||||
this.$el.style.overflowY = 'scroll';
|
||||
this.$el.style.height = this.$el.style.maxHeight;
|
||||
} else {
|
||||
this.$el.style.overflow = 'hidden';
|
||||
}
|
||||
},
|
||||
onInput(event) {
|
||||
if (this.autoResize) {
|
||||
this.resize();
|
||||
}
|
||||
|
||||
this.$emit('update:modelValue', event.target.value);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filled() {
|
||||
return this.modelValue != null && this.modelValue.toString().length > 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.p-inputtextarea-resizable {
|
||||
overflow: hidden;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.p-fluid .p-inputtextarea {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue