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: control hook #764

Merged
merged 3 commits into from
May 13, 2022
Merged

fix: control hook #764

merged 3 commits into from
May 13, 2022

Conversation

PengYYYYY
Copy link
Collaborator

@PengYYYYY PengYYYYY commented May 12, 2022

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

useVModeluseDefaultValue 在之前的实现中,通过判断value 是否为undefined来判断组件的非受控与受控,且这个执行时间在组件初始化阶段,当用户传入 value 为 undefined,会进入非受控模式。后续用户从外部对value的变化将不会驱动组件进行innerValue的变化。

下面代码可复现问题

<template>
  <div class="tdesign-demo-block-column" style="max-width: 500px">
    <t-input v-model="input" @change="onChange" />
    <t-input :value="input" placeholder="请输入内容(有默认值)" @change="onChange" />
  </div>
</template>
<script setup>
import { ref } from 'vue';

const input = ref(undefined);
const onChange = (val) => {
  input.value = val;
};
</script>

修复前

May-12-2022 23-27-27

修复后

May-12-2022 23-29-49

timePicker 修复

修复前

May-12-2022 23-31-52

修复后

May-12-2022 23-31-21

📝 更新日志

  • fix(form): 修复当modelValue为外部传入的undefined时,双向绑定失效 (issue #712)
  • fix(form): 修复 attrs 注入异常 (issue #671)
  • fix(timePicker): 修复当modelValue为外部传入的undefined时,clearable失效 (issue #722)

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

Size Change: -11 B (0%)

Total Size: 665 kB

Filename Size Change
./dist/tdesign.js 370 kB -40 B (0%)
./dist/tdesign.min.js 211 kB +29 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/tdesign.css 44.7 kB
./dist/tdesign.min.css 39.7 kB

@github-actions
Copy link
Contributor

github-actions bot commented May 12, 2022

完成

@github-actions
Copy link
Contributor

Size Change: -41 B (0%)

Total Size: 665 kB

Filename Size Change
./dist/tdesign.js 370 kB -55 B (0%)
./dist/tdesign.min.js 211 kB +14 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/tdesign.css 44.7 kB
./dist/tdesign.min.css 39.7 kB

@codecov-commenter
Copy link

codecov-commenter commented May 12, 2022

Codecov Report

❗ No coverage uploaded for pull request base (develop@74673ef). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             develop     #764   +/-   ##
==========================================
  Coverage           ?   61.52%           
==========================================
  Files              ?      405           
  Lines              ?    14148           
  Branches           ?     2690           
==========================================
  Hits               ?     8704           
  Misses             ?     5190           
  Partials           ?      254           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74673ef...8813af0. Read the comment docs.

@github-actions
Copy link
Contributor

Size Change: -48 B (0%)

Total Size: 665 kB

Filename Size Change
./dist/tdesign.js 370 kB -59 B (0%)
./dist/tdesign.min.js 211 kB +11 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/tdesign.css 44.7 kB
./dist/tdesign.min.css 39.7 kB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants