mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(checkbox): fix warn about lacking default value of inject
This commit is contained in:
committed by
Herrington Darkholme
parent
6058363b6b
commit
d5d7e8700e
@@ -13,9 +13,9 @@ import { ICheckboxGroupInstance, ICheckboxProps } from './checkbox'
|
||||
export const useCheckboxGroup = () => {
|
||||
//todo: ELEMENT
|
||||
const ELEMENT = null
|
||||
const elForm = inject<any>('elForm')
|
||||
const elFormItem = inject<any>('elFormItem')
|
||||
const checkboxGroup = inject<ICheckboxGroupInstance>('CheckboxGroup')
|
||||
const elForm = inject<any>('elForm', {})
|
||||
const elFormItem = inject<any>('elFormItem', {})
|
||||
const checkboxGroup = inject<ICheckboxGroupInstance>('CheckboxGroup', {})
|
||||
const isGroup = computed(() => checkboxGroup && checkboxGroup?.name === 'ElCheckboxGroup')
|
||||
const elFormItemSize = computed(() => {
|
||||
return elFormItem?.elFormItemSize
|
||||
@@ -71,7 +71,7 @@ const useModel = (props: ICheckboxProps) => {
|
||||
const useCheckboxStatus = (props: ICheckboxProps, { model }: PartialReturnType<typeof useModel>) => {
|
||||
const { isGroup, checkboxGroup, elFormItemSize, ELEMENT } = useCheckboxGroup()
|
||||
const focus = ref(false)
|
||||
const size = computed<string|undefined>(() => checkboxGroup?.checkboxGroupSize?.value || elFormItemSize.value || ELEMENT?.size)
|
||||
const size = computed<string | undefined>(() => checkboxGroup?.checkboxGroupSize?.value || elFormItemSize.value || ELEMENT?.size)
|
||||
const isChecked = computed(() => {
|
||||
const value = model.value
|
||||
if (toTypeString(value) === '[object Boolean]') {
|
||||
@@ -110,7 +110,7 @@ const useDisabled = (
|
||||
})
|
||||
const isDisabled = computed(() => {
|
||||
return isGroup.value
|
||||
? checkboxGroup?.disabled?.value || props.disabled || elForm?.disabled?.value || isLimitDisabled.value
|
||||
? checkboxGroup?.disabled?.value || props.disabled || elForm?.disabled?.value || isLimitDisabled.value
|
||||
: props.disabled || elForm?.disabled?.value
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user