feat: ✨ Swiper 轮播组件增加value-key用于自定义目标字段属性名#485
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 (
|
✅ Deploy Preview for wot-design-uni ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Deploying wot-design-uni with
|
| Latest commit: |
cf3cdef
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f8ae027c.wot-design-uni.pages.dev |
| Branch Preview URL: | https://feature-swiper-value-key.wot-design-uni.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- docs/component/swiper.md (3 hunks)
- src/pages/swiper/Index.vue (3 hunks)
- src/uni_modules/wot-design-uni/components/wd-swiper/types.ts (2 hunks)
- src/uni_modules/wot-design-uni/components/wd-swiper/wd-swiper.vue (2 hunks)
Additional comments not posted (10)
src/uni_modules/wot-design-uni/components/wd-swiper/types.ts (2)
23-23: 更改SwiperList接口中的value属性为可选将
value属性更改为可选属性提高了接口的灵活性,允许在某些情况下省略该属性。
146-149: 添加valueKey属性到swiperProps新增的
valueKey属性允许用户指定选项对象中value对应的键,增强了 Swiper 组件的灵活性。src/uni_modules/wot-design-uni/components/wd-swiper/wd-swiper.vue (2)
20-22: 调整模板中的图片来源绑定图片来源绑定现在根据
valueKey从item对象中获取属性,确保正确的图片来源动态确定,增强了灵活性。
164-167: 更新handleClick函数以接受额外的item参数
handleClick函数现在接受一个额外的item参数,使组件在点击 swiper 项时能够发出索引和项内容,提供更多上下文信息。src/pages/swiper/Index.vue (2)
113-115: 添加新的演示块以展示value-key属性的使用新增的演示块展示了如何使用
value-key属性,提供了一个清晰的示例。
145-151: 添加customSwiperList和current9的响应式引用新增的响应式引用
customSwiperList和current9用于管理新演示块的状态,确保其正常运行。Also applies to: 161-161
docs/component/swiper.md (4)
189-191: 文档更新: 指定value-key属性文档清晰地介绍了如何使用
value-key属性来指定list中每个对象图片地址字段,默认为value。这有助于用户理解和使用该新功能。
194-196: 示例代码: 使用value-key属性示例代码展示了如何使用
value-key属性来指定对象中的图片URL字段。代码清晰易懂,能够帮助用户快速上手新功能。
198-205: 示例代码: 自定义swiperList示例代码展示了如何定义一个包含对象的
swiperList,并使用value-key属性来指定图片URL字段。代码清晰且符合实际使用场景。
289-289: 事件更新:click事件参数文档更新了
click事件的参数,现在不仅返回点击项的索引,还返回相关项的内容。这一改进为事件处理提供了更多上下文信息,增强了事件的实用性。
✅ Closes: #410
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
💡 需求背景和解决方案
提供
value-key属性用于自定义选项值字段☑️ 请求合并前的自查清单
Summary by CodeRabbit
新功能
wd-swiper组件中添加了value-key属性,允许用户自定义图像 URL 的键。click事件的参数,提供了更详尽的事件信息,包括点击项的内容。Index.vue中引入新的演示块,支持动态显示自定义图像列表。文档
wd-swiper文档,增加了使用value-key属性及更新后的click事件签名示例。