From badc3da296c438ba1d59eaade3d761ed4d9ff464 Mon Sep 17 00:00:00 2001 From: taohebin Date: Thu, 6 Jun 2024 12:17:40 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=20=E8=A1=A5=E5=85=85input?= =?UTF-8?q?=E3=80=81textarea=E7=9A=84=E7=A4=BA=E4=BE=8B=E5=92=8C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/input/input.uvue | 18 +- pages/component/textarea/textarea.test.js | 17 + pages/component/textarea/textarea.uvue | 365 ++++++++++++---------- 3 files changed, 230 insertions(+), 170 deletions(-) diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue index 7193a802..5a8f6e94 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -248,6 +248,17 @@ + + + + 设置adjust-position + + + + + + + @@ -282,7 +293,8 @@ holdKeyboard: false, keyboardHeight: 0, focusedForKeyboardHeightChangeTest: false, - demoValue: '123' + demoValue: '123', + adjustPosition: false } }, methods: { @@ -359,6 +371,10 @@ changeHoldKeyboard(event : UniSwitchChangeEvent) { const checked = event.detail.value; this.holdKeyboard = checked + }, + changeAdjustPosition(event : UniSwitchChangeEvent){ + const checked = event.detail.value; + this.adjustPosition = checked } } } diff --git a/pages/component/textarea/textarea.test.js b/pages/component/textarea/textarea.test.js index 9676d2dd..8c985438 100644 --- a/pages/component/textarea/textarea.test.js +++ b/pages/component/textarea/textarea.test.js @@ -81,4 +81,21 @@ describe('component-native-textarea', () => { expect(await textarea2.value()).toBe("123") }) } + + it("maxlength", async () => { + const input = await page.$('#textarea-instance-maxlength'); + let str = ""; + for(let i = 0;i < 200;i++){ + str += `${i}` + } + await page.setData({ + textareaMaxLengthValue: str + }) + let length = (await input.value()).length + expect(length).toBe(10) + await page.setData({ + textareaMaxLengthValue: "" + }) + }) + }); diff --git a/pages/component/textarea/textarea.uvue b/pages/component/textarea/textarea.uvue index 8b4e0862..81ac3d87 100644 --- a/pages/component/textarea/textarea.uvue +++ b/pages/component/textarea/textarea.uvue @@ -1,170 +1,197 @@ - - - - - -- GitLab