File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
resources/views/components/textarea Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 1414 x-data =" {
1515 native: false,
1616 minHeight: null,
17- height: null,
1817 init() {
1918 this.native = CSS.supports('field-sizing: content');
2019
20+ this.minHeight = this.$el.getBoundingClientRect().height;
21+
2122 if (!this.native) {
2223 this.$nextTick(() => {
23- this.minHeight = this.$el.getBoundingClientRect().height;
24- this.height = this.$el.scrollHeight;
24+ this.resize();
2525 });
2626 }
2727
2828 },
29+ resize() {
30+ this.$el.style.height = `${this.minHeight}px`;
31+ this.$el.style.height = `${this.$el.scrollHeight}px`;
32+ },
2933 onInput(event) {
3034 if (!this.native) {
31- this.height = this.minHeight;
32- this.$nextTick(() => {
33- this.height = this.$el.scrollHeight;
34- });
35+ this.resize();
3536 }
3637 },
37- }" x-on:input =" onInput" x-on:focus =" onInput"
38- x-bind:style =" {
39- 'height': height ? `${height}px` : '',
40- }" >{{ $slot } } </textarea >
38+ }" x-on:input =" onInput" x-intersect =" onInput" >{{ $slot } } </textarea >
You can’t perform that action at this time.
0 commit comments