-
-
Notifications
You must be signed in to change notification settings - Fork 338
docs: ✏️ 增加 ConfigProvider 组件设定全局共享示例 #758
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough该拉取请求显著扩展了 Changes
Possibly related PRs
Suggested reviewers
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: 2
🧹 Outside diff range and nitpick comments (3)
docs/component/config-provider.md (3)
131-143: 建议添加版本号信息安装说明清晰完整,建议添加所需的最低版本号信息,以帮助用户避免兼容性问题。
166-168: 建议补充插件顺序说明关于插件顺序的提示很重要,建议补充具体原因说明,例如:
"由于 UniKuRoot 需要访问最终的 pages.json 配置,因此必须放置在其他修改 pages.json 的插件之后,否则可能导致路由配置不正确。"
234-234: 建议说明路径别名使用示例中使用了
@/路径别名,建议补充说明:
- 这需要在项目中正确配置路径别名
- 用户也可以根据自己的项目结构使用相对路径
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
docs/component/config-provider.md(1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.35.0)
docs/component/config-provider.md
174-174: Expected: underscore; Actual: asterisk
Strong style
(MD050, strong-style)
174-174: Expected: underscore; Actual: asterisk
Strong style
(MD050, strong-style)
175-175: Expected: underscore; Actual: asterisk
Strong style
(MD050, strong-style)
175-175: Expected: underscore; Actual: asterisk
Strong style
(MD050, strong-style)
| <!-- 假设已注册 WdConfigProvider 组件 --> | ||
| <WdConfigProvider :theme="theme" :theme-vars="themeVars"> |
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.
🛠️ Refactor suggestion
需要补充组件注册说明
示例代码中假设 WdConfigProvider 组件已经注册,建议添加如何注册该组件的说明,例如:
<script setup lang="ts">
import { WdConfigProvider } from 'wot-design-uni'
</script>| const theme = ref<'light' | 'dark'>(false) | ||
| const themeVars = ref<ConfigProviderThemeVars>() |
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.
建议改进状态管理方式
当前实现将状态存储在组合函数外部,这可能导致在某些场景下出现意外的状态共享。建议改进实现方式:
- const theme = ref<'light' | 'dark'>(false)
- const themeVars = ref<ConfigProviderThemeVars>()
export function useTheme(vars?: ConfigProviderThemeVars) {
+ const theme = ref<'light' | 'dark'>('light')
+ const themeVars = ref<ConfigProviderThemeVars>()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const theme = ref<'light' | 'dark'>(false) | |
| const themeVars = ref<ConfigProviderThemeVars>() | |
| export function useTheme(vars?: ConfigProviderThemeVars) { | |
| const theme = ref<'light' | 'dark'>('light') | |
| const themeVars = ref<ConfigProviderThemeVars>() |
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
💡 需求背景和解决方案
☑️ 请求合并前的自查清单
Summary by CodeRabbit
ConfigProvider组件的文档,新增“全局共享”部分。@uni-ku/root包的安装说明。App.ku.vue)的使用说明。useTheme)。