-
Notifications
You must be signed in to change notification settings - Fork 276
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
fix(dropdown): [dropdown] fixed the data disorder issue caused by the composite scenario of two-layer components and self-invoking groups. #2553
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 | ||||
---|---|---|---|---|---|---|
|
@@ -56,7 +56,9 @@ | |||||
:key="index" | ||||||
:label="item[state.textField]" | ||||||
:item-data="item" | ||||||
:_constants="_constants" | ||||||
:icon="item.icon" | ||||||
:is-mono="true" | ||||||
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. 🛠️ Refactor suggestion Consider binding to parent's isMono prop instead of hardcoding. The hardcoded -:is-mono="true"
+:is-mono="isMono" 📝 Committable suggestion
Suggested change
|
||||||
:disabled="item.disabled" | ||||||
:divided="item.divided" | ||||||
:tip="item.tip" | ||||||
|
@@ -102,13 +104,15 @@ export default defineComponent({ | |||||
'textField', | ||||||
'tip', | ||||||
'tipPosition', | ||||||
'effect' | ||||||
'effect', | ||||||
'isMono' | ||||||
Comment on lines
+107
to
+108
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. 🛠️ Refactor suggestion Add proper prop definitions with types and documentation. The props should be properly defined with types, defaults, and documentation to improve maintainability and developer experience. -'effect',
-'isMono'
+'effect': {
+ type: String,
+ default: 'dark',
+ validator: (value: string) => ['dark', 'light'].includes(value),
+ description: 'Controls the tooltip theme effect'
+},
+'isMono': {
+ type: Boolean,
+ default: false,
+ description: 'Controls the mono mode behavior for nested dropdown items'
+}
|
||||||
], | ||||||
components: { | ||||||
IconLeftWardArrow: iconLeftWardArrow() | ||||||
}, | ||||||
setup(props, context) { | ||||||
return setup({ props, context, renderless, api }) as unknown as IDropdownItemApi | ||||||
// 修复 <双层组件 + 自调用组件> 复合场景导致的数据混乱问题 | ||||||
return setup({ props, context, renderless, api, mono: props.isMono }) as unknown as IDropdownItemApi | ||||||
} | ||||||
}) | ||||||
</script> |
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.
Define the _constants prop in props array.
The
_constants
prop is being used in the template but is not defined in the component's props array. This could lead to Vue warnings and potential runtime issues.Add the prop definition:
props: [ ...props, + '_constants', 'disabled', // ... other props ],