Skip to content
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

feat(checkboxGroup): add min max prop #491

Merged
merged 60 commits into from
Jul 16, 2021

Conversation

doom-9-zz
Copy link
Contributor

No description provided.

doom-9 and others added 30 commits June 17, 2021 17:42
Comment on lines 86 to 99
const minRef = computed(() => {
if (props.min && props.max) {
return Math.floor(Math.min(props.min, props.max))
} else {
return props.min ? Math.floor(props.min) : 0
}
})
const maxRef = computed(() => {
if (props.min && props.max) {
return Math.floor(Math.max(props.min, props.max))
} else {
return props.max ? Math.floor(props.max) : Infinity
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉 min max 的 undefined 在 disabled 里面处理就好了,都转成数字反而很麻烦

disabledUptoNCheckboxGroupPropMin ||
disabledUptoNCheckboxGroupPropMax
}
return props.disabled || disabledUptoNCheckboxGroup
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

props.disabled 放在最开始

if (props.disabled) return true

下面的判断走
if (min !== undefined) {
if () return true
}

if (max !== undefined) {
if () return true
}

return xxx

!renderedCheckedRef.value)
)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
return false

if (props.disabled) return true
if (NCheckboxGroup) {
if (NCheckboxGroup.disabledRef.value) return true
if (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (
const {
maxRef: { value: max },
minRef: { value: min }
} = NCheckboxGroup
if (

NCheckboxGroup.maxRef.value !== undefined &&
NCheckboxGroup.minRef.value !== undefined
) {
return (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (
const { checkedCountRef: { value: checkedCount } } = NCheckboxGroup
return (

Comment on lines 86 to 99
const minRef = computed(() => {
if (props.min && props.max) {
return Math.floor(Math.min(props.min, props.max))
} else {
return props.min
}
})
const maxRef = computed(() => {
if (props.min && props.max) {
return Math.floor(Math.max(props.min, props.max))
} else {
return props.max
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const minRef = computed(() => {
if (props.min && props.max) {
return Math.floor(Math.min(props.min, props.max))
} else {
return props.min
}
})
const maxRef = computed(() => {
if (props.min && props.max) {
return Math.floor(Math.max(props.min, props.max))
} else {
return props.max
}
})
const minRef = toRef(props, 'min')
const maxRef = toRef(props, 'max')

@07akioni
Copy link
Collaborator

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants