From 5909333f96984b8add07e5830714f147c43d0930 Mon Sep 17 00:00:00 2001 From: chenjiajian <770230504@qq.com> Date: Wed, 12 Apr 2023 23:04:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 55d817e..0815beb 100644 --- a/Readme.md +++ b/Readme.md @@ -20,7 +20,7 @@ - [ ] `wc-avatar`头像组件 - [x] `wc-badge`徽标组件 - [x] `wc-drawer`抽屉组件 -- [ ] `wc-collapse`折叠组件 +- [x] `wc-collapse`折叠组件 - [ ] `wc-counter`倒计时组件 - [ ] `wc-drag`拖拽组件 - [x] `wc-image`图片组件 From e814a81b231a3a8cd2125bdf6048e5bb696625b8 Mon Sep 17 00:00:00 2001 From: chenjiajian <770230504@qq.com> Date: Thu, 13 Apr 2023 10:59:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?textarea=E6=94=AF=E6=8C=81=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/textarea.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/form/textarea.js b/src/form/textarea.js index 3c1eef7..27bc722 100644 --- a/src/form/textarea.js +++ b/src/form/textarea.js @@ -11,12 +11,13 @@ class TextArea extends Component { value: { type: String, default: '', - attributes: false + attribute: false }, type: '', autofocus: false, readOnly: false, disabled: false, + autosize: false, maxlength: null, minlength: null, 'show-limit': false, @@ -29,7 +30,7 @@ class TextArea extends Component { :host { display: flex; width: 100%; - height: 80px; + // height: 80px; user-select: none; -moz-user-select: none; color: var(--color-dark-1); @@ -53,7 +54,7 @@ class TextArea extends Component { flex: 1; min-width: 36px; width: 100%; - height: 100%; + height: auto; padding: 5px 8px; border: 0; border-radius: inherit; @@ -153,6 +154,13 @@ class TextArea extends Component { ] onInput(e) { this.value = e.target.value + if (this.autosize) { + nextTick(() => { + this.$refs.textarea.style.height = 'auto' + let height = this.$refs.textarea.scrollHeight + 'px' + this.$refs.textarea.style.height = height + }) + } } onKeydown(ev) { // console.log(ev.target) From 6f8711f11cea11bcb3d067eab000cbec9341e2e4 Mon Sep 17 00:00:00 2001 From: chenjiajian <770230504@qq.com> Date: Thu, 13 Apr 2023 11:04:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96css=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/textarea.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/form/textarea.js b/src/form/textarea.js index 27bc722..b2ca7e8 100644 --- a/src/form/textarea.js +++ b/src/form/textarea.js @@ -30,7 +30,7 @@ class TextArea extends Component { :host { display: flex; width: 100%; - // height: 80px; + min-height: 80px; user-select: none; -moz-user-select: none; color: var(--color-dark-1); @@ -42,7 +42,7 @@ class TextArea extends Component { .label { position: relative; width: 100%; - height: 100%; + min-height: 100%; font-size: 14px; border: 1px solid var(--color-grey-2); border-radius: inherit; @@ -54,7 +54,7 @@ class TextArea extends Component { flex: 1; min-width: 36px; width: 100%; - height: auto; + height: 100%; padding: 5px 8px; border: 0; border-radius: inherit; From f99f1b34f31ef94bbd9608f4e3d1778ad724b685 Mon Sep 17 00:00:00 2001 From: chenjiajian <770230504@qq.com> Date: Thu, 13 Apr 2023 14:23:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96css=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/textarea.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/form/textarea.js b/src/form/textarea.js index b2ca7e8..91fc30d 100644 --- a/src/form/textarea.js +++ b/src/form/textarea.js @@ -38,7 +38,9 @@ class TextArea extends Component { cursor: text; transition: box-shadow 0.15s linear; } - + :host([autosize]) textarea { + overflow: hidden; + } .label { position: relative; width: 100%;