-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: conditionally render form items based on feature flags #4035
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,7 @@ | |
| </div> | ||
| </template> | ||
| </div> | ||
| <el-form-item @click.prevent> | ||
| <el-form-item @click.prevent v-if="chat_data.mcp_enable || chat_data.tool_enable"> | ||
| <template #label> | ||
| <div class="flex-between"> | ||
| <span class="mr-4"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code snippet has the following issues:
Here's the corrected version: <el-form-item @click.prevent v-if="chat_data.mcp_enable || chat_data.tool_enable">
<template #label>
<div class="flex-between">
<span class="mr-4">...</span><!-- Fill with actual content -->
</div>
</template>
</el-form-item>Note: Ensure that all necessary imports, such as |
||
|
|
||
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.
The code appears to be part of an HTML template for an El Form Item. Here are some potential concerns and suggestions:
Conditional Directive (
v-if):@click.prevent v-if="applicationForm.mcp_enable || applicationForm.tool_enable"directive suggests that this form item is only visible depending on certain conditions. This seems logical, but ensure these conditions are appropriate.PreventDefault Event Listener:
@click.prevent. It's important to avoid repeating event listeners with the same default behavior if they serve a similar purpose across different scopes.Element Type:
<el-form-item>element used within another component. If it isn't needed under certain conditions, removing the conditional could save computation.Accessibility:
Here is revised version of the line incorporating some of these considerations:
This modification ensures better SEO and assistive technology compatibility without duplicating event listeners. Adjust labels and aria attributes as necessary for specific contexts.