-
Notifications
You must be signed in to change notification settings - Fork 321
fix:[docs]Hide the plus document drill field button #3309
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
WalkthroughThe logic for the computed property Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Component
User->>Component: Load component
Component->>Component: Compute isPlus (check VITE_APP_MODE)
alt VITE_APP_MODE equals "plus"
Component-->>User: Render UI without playground icon
else VITE_APP_MODE not "plus"
Component-->>User: Render UI with playground icon
end
Possibly related PRs
Suggested labels
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
examples/sites/src/views/components-doc/components/demo.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. examples/sites/src/views/overview.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (1)
🪧 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 (
|
@@ -115,6 +116,7 @@ const { currentThemeKey } = useTheme() | |||
const isMobileFirst = computed(() => { | |||
return templateModeState.mode === 'mobile-first' | |||
}) | |||
const isPlus = computed(() => location.href.includes('tiny-vue-plus')) |
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.
我记得之前你也加过这句判断,这属于散点式代码,后面不好维护,是不是可以在一个地方统一管理下isPlus,建议用env变量
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
🧹 Nitpick comments (1)
examples/sites/src/views/components-doc/components/demo.vue (1)
119-119
: The computed property implementation is simple and effective.The
isPlus
computed property correctly identifies plus documentation by checking if the URL contains 'tiny-vue-plus'. This approach is straightforward and achieves the intended goal.Consider using a more robust URL checking method for future enhancements:
-const isPlus = computed(() => location.href.includes('tiny-vue-plus')) +const isPlus = computed(() => { + // Use URL API for more robust parsing + const currentUrl = new URL(location.href) + return currentUrl.pathname.includes('tiny-vue-plus') || currentUrl.hostname.includes('tiny-vue-plus') +})This would make the check more specific and less prone to false positives, but the current implementation is sufficient for the immediate requirement.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/sites/src/views/components-doc/components/demo.vue
(2 hunks)
🔇 Additional comments (1)
examples/sites/src/views/components-doc/components/demo.vue (1)
31-36
: Conditionally hiding the playground button works as expected.The added
v-if="!isPlus"
condition correctly implements the requirement to hide the playground button when viewing the plus documentation. This ensures the drill field button is not shown when the URL contains "tiny-vue-plus".
adbce52
to
1eac536
Compare
PR
plus文档隐藏演练场按钮
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit