mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Merge pull request #6630 from KumJungMin/fix/issue-4510
fix(TextArea): autoResize issue with v-show by implementing ResizeObserver
This commit is contained in:
commit
aa92d01043
1 changed files with 13 additions and 3 deletions
|
@ -11,17 +11,27 @@ export default {
|
||||||
extends: BaseTextarea,
|
extends: BaseTextarea,
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.$el.offsetParent && this.autoResize) {
|
if (this.autoResize) {
|
||||||
this.resize();
|
this.observer = new ResizeObserver(() => {
|
||||||
|
this.resize();
|
||||||
|
});
|
||||||
|
this.observer.observe(this.$el);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
if (this.$el.offsetParent && this.autoResize) {
|
if (this.autoResize) {
|
||||||
this.resize();
|
this.resize();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
if (this.observer) {
|
||||||
|
this.observer.disconnect();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resize() {
|
resize() {
|
||||||
|
if (!this.$el.offsetParent) return;
|
||||||
|
|
||||||
this.$el.style.height = 'auto';
|
this.$el.style.height = 'auto';
|
||||||
this.$el.style.height = this.$el.scrollHeight + 'px';
|
this.$el.style.height = this.$el.scrollHeight + 'px';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue