-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
feat: ✨tabs底部条颜色支持自由设置 #782
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough此次更改涉及对 Changes
Possibly related PRs
Suggested reviewers
Poem
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for wot-design-uni ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
docs/component/tabs.md (1)
266-266
: 建议添加使用示例文档中已经清晰地说明了
lineBgColor
属性的功能,但建议添加一个具体的使用示例,以帮助开发者更好地理解如何自定义底部条的颜色。示例代码可以是:
<wd-tabs v-model="tab" lineBgColor="#ff0000"> <wd-tab v-for="item in 4" :key="item" :title="`标签${item}`"> <view class="content">内容{{ item }}</view> </wd-tab> </wd-tabs>src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue (2)
323-325
: 优化 lineBgColor 的应用方式当前实现中使用
addUnit
处理lineBgColor
是不必要的,因为颜色值不需要单位转换。建议直接使用颜色值:- lineStyle.background = addUnit(lineBgColor) + lineStyle.background = lineBgColor
311-312
: 建议优化错误处理在解构 props 时,建议使用更具体的错误处理,以便于定位问题:
const { autoLineWidth, lineWidth, lineHeight, lineBgColor } = props try { + if (lineBgColor && !/^#([0-9A-Fa-f]{3}){1,2}$|^rgb\(.*\)$|^rgba\(.*\)$/.test(lineBgColor)) { + console.warn('[wot design] warning(wd-tabs): lineBgColor should be a valid color value') + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docs/component/tabs.md
(1 hunks)src/uni_modules/wot-design-uni/components/wd-tabs/types.ts
(1 hunks)src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue
(2 hunks)
🔇 Additional comments (1)
src/uni_modules/wot-design-uni/components/wd-tabs/types.ts (1)
62-65
: 类型定义正确且符合最佳实践!
lineBgColor
属性的类型定义使用 makeStringProp('')
符合组件库的约定。
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
💡 需求背景和解决方案
1.使tabs的底部条可以自由设置颜色,不再局限于使用单一颜色
2.tabs 增加lineBgColor属性,需要修改颜色时将颜色值传给lineBgColor即可
3.
☑️ 请求合并前的自查清单
Summary by CodeRabbit
新功能
wd-tabs
组件的文档,添加了多个新属性,包括badge-props
、auto-line-width
、sticky
、slidable
、disabled
、swipeable
和animated
。lineBgColor
属性,允许用户自定义标签底部线条的颜色。updateLineStyle
方法,以支持在弹出上下文中更新活动标签的样式。文档
wd-tabs
组件的使用说明和方法部分,提供了更清晰的指导。