Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(textarea): 修复h5下双向绑定失效的问题 (#2767) #2768

Merged
merged 2 commits into from
Dec 20, 2023
Merged

fix(textarea): 修复h5下双向绑定失效的问题 (#2767) #2768

merged 2 commits into from
Dec 20, 2023

Conversation

Moonofweisheng
Copy link
Contributor

这个 PR 做了什么? (简要描述所做更改)
Textarea组件中从event取值使用了event.target.value,此逻辑在taro的h5端始终返回'',导致双向绑定无效,字数统计也无效。

    const _onInput = (event: Event) => {
      const input = event.target as HTMLInputElement;
      let value = input.value;
      if (props.maxLength && value.length > Number(props.maxLength)) {
        value = value.slice(0, Number(props.maxLength));
      }
      emitChange(value, event);
    };

现改为从event.detail.value中取值。

    const _onInput = (event: any) => {
      let { value } = event.detail;
      if (props.maxLength && value.length > Number(props.maxLength)) {
        value = value.slice(0, Number(props.maxLength));
      }
      emitChange(value, event);
    };

这个 PR 是什么类型? (至少选择一个)

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 代码重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

这个 PR 涉及以下平台:

  • NutUI 4.0 H5
  • NutUI 4.0 小程序
  • NutUI 3.0 H5
  • NutUI 3.0 小程序

这个 PR 是否已自测:

@eiinu eiinu linked an issue Dec 18, 2023 that may be closed by this pull request
@eiinu eiinu added this to the v4.2.5 milestone Dec 18, 2023
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e830615) 85.21% compared to head (a77e9ed) 85.21%.

Additional details and impacted files
@@           Coverage Diff           @@
##               v4    #2768   +/-   ##
=======================================
  Coverage   85.21%   85.21%           
=======================================
  Files         166      166           
  Lines       21178    21178           
  Branches     2386     2386           
=======================================
  Hits        18047    18047           
  Misses       3126     3126           
  Partials        5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eiinu eiinu merged commit 4c7d346 into jdf2e:v4 Dec 20, 2023
6 checks passed
eiinu added a commit to eiinu/nutui that referenced this pull request Feb 29, 2024
eiinu added a commit that referenced this pull request Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Textarea 组件在h5端双向绑定无效
2 participants