-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Pr@dev v3 st #16466
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
Pr@dev v3 st #16466
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,7 +99,7 @@ const placeholderText = computed(() => { | |
const cascade = computed(() => { | ||
return cascadeList() || [] | ||
}) | ||
|
||
let time | ||
const disabledFirstItem = computed(() => { | ||
const { defaultValueFirstItem, optionValueSource, multiple } = props.config | ||
return defaultValueFirstItem && optionValueSource === 1 && !multiple | ||
|
@@ -126,6 +126,7 @@ const setDefaultMapValue = arr => { | |
} | ||
|
||
onUnmounted(() => { | ||
clearTimeout(time) | ||
enumValueArr = [] | ||
}) | ||
|
||
|
@@ -219,6 +220,12 @@ const handleValueChange = () => { | |
setCascadeValueBack(config.value.mapValue) | ||
emitCascade() | ||
nextTick(() => { | ||
console.log( | ||
'disabledFirstItem.value', | ||
disabledFirstItem.value, | ||
selectValue.value, | ||
cloneDeep(config.value) | ||
) | ||
isConfirmSearch(config.value.id, disabledFirstItem.value) | ||
}) | ||
return | ||
|
@@ -373,7 +380,10 @@ const handleFieldIdChange = (val: EnumValue) => { | |
} | ||
|
||
if (disabledFirstItem.value) { | ||
setDefaultValueFirstItem() | ||
time = setTimeout(() => { | ||
clearTimeout(time) | ||
setDefaultValueFirstItem() | ||
}, 300) | ||
} | ||
|
||
isFromRemote.value = false | ||
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. 在你的代码中,以下几点可能存在不规范、潜在问题或优化建议:
总结来说,上述点主要涉及到变量管理和组件生命周期。通过合理的命名和逻辑设计,我们可以减少潜在的问题并提高代码的可维护性。 |
||
|
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.
代码基本没有问题,但可以有一些改进点:
字符串常量复用:
这样可以避免不必要的字符串拼接,并且更具可读性。
简化日志输出(如果不需要保留):如果没有特殊需求,可以直接移除这些调试信息。
总结来说,代码已经相当符合最佳实践,主要关注性能和可维护性方面。