feat: ✨ Input 组件新增clear-triger属性#476
Conversation
✅ Closes: #462
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for wot-design-uni ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Walkthrough这次更改主要集中在增强 Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- docs/component/input.md (2 hunks)
- docs/component/search.md (1 hunks)
- src/pages/input/Index.vue (3 hunks)
- src/uni_modules/wot-design-uni/components/wd-input/types.ts (2 hunks)
- src/uni_modules/wot-design-uni/components/wd-input/wd-input.vue (5 hunks)
Files skipped from review due to trivial changes (1)
- docs/component/search.md
Additional context used
Markdownlint
docs/component/input.md
168-168: Column: 67
Hard tabs(MD010, no-hard-tabs)
168-168: Column: 90
Hard tabs(MD010, no-hard-tabs)
Additional comments not posted (18)
src/uni_modules/wot-design-uni/components/wd-input/types.ts (3)
4-4: 新类型定义InputClearTrigger看起来很好。这个新类型定义提供了明确的选项,用于控制
clearTrigger属性的行为。
164-164: 新属性clearTrigger定义得很好。该属性使用了新定义的
InputClearTrigger类型,并且默认值为 'always',这是一个合理的默认值。
171-171: 新属性focusWhenClear定义得很好。该属性默认值为
true,提供了控制清除按钮点击时焦点行为的有用功能。src/pages/input/Index.vue (4)
18-20: 新演示块clear-trigger实现得很好。该演示块清晰地展示了
clear-trigger属性的功能,当输入框有值且聚焦时显示清空按钮。
21-23: 新演示块focus-when-clear实现得很好。该演示块清晰地展示了
focus-when-clear属性的功能,当点击清除按钮时不自动聚焦。
85-85: 新响应式变量value20定义得很好。该变量被正确声明为引用,并集成到组件的状态管理中。
86-86: 新响应式变量value21定义得很好。该变量被正确声明为引用,并集成到组件的状态管理中。
docs/component/input.md (3)
47-52: 新文档clear-trigger解释得很好。文档清晰地解释了
clear-trigger属性,并提供了一个有用的示例。
54-60: 新文档focus-when-clear解释得很好。文档清晰地解释了
focus-when-clear属性,并提供了一个有用的示例。
168-170: 属性表中的新属性添加得很好。属性表更新正确,并为开发者提供了必要的信息。
Tools
Markdownlint
168-168: Column: 67
Hard tabs(MD010, no-hard-tabs)
168-168: Column: 90
Hard tabs(MD010, no-hard-tabs)
src/uni_modules/wot-design-uni/components/wd-input/wd-input.vue (8)
143-150: 代码更改通过!
showClear计算属性的逻辑正确,符合 PR 目标。
155-158: 代码更改通过!
showWordCount计算属性的逻辑正确,符合 PR 目标。
220-226: 代码更改通过!
formatValue函数的逻辑正确,符合 PR 目标。
232-248: 代码更改通过!
clear函数的修改逻辑正确,符合 PR 目标。
251-259: 代码更改通过!
handleBlur函数的修改逻辑正确,符合 PR 目标。
267-269: 代码更改通过!
handleFocus函数的修改逻辑正确,符合 PR 目标。
216-218: 代码更改通过!
initState函数的简化逻辑正确,符合 PR 目标。
Line range hint
270-272:
代码更改通过!
handleInput函数的修改逻辑正确,符合 PR 目标。
✅ Closes: #462
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
#462
💡 需求背景和解决方案
增加clear-triger用于控制clear显示的时机
☑️ 请求合并前的自查清单
Summary by CodeRabbit
新功能
wd-input组件添加了clear-trigger和focus-when-clear属性,以增强用户交互体验。Index.vue中引入了新的输入字段,优化了清除按钮的显示逻辑和输入框的焦点管理。文档
wd-input组件的文档,描述了新属性的功能和默认值,帮助开发者更好地理解和使用这些功能。样式
wd-search组件中关于自定义的注释,简化了代码结构。