mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
Co-authored-by: yangyu8 <yangyu8@kingsoft.com>
This commit is contained in:
parent
e2e3ace5db
commit
f9e4da734d
@ -330,4 +330,12 @@ describe('check-button', () => {
|
||||
expect(wrapper.vm.checked).toBe(true)
|
||||
expect(wrapper.vm.checklist).toEqual(['a'])
|
||||
})
|
||||
|
||||
test('checked', () => {
|
||||
const wrapper = _mount(
|
||||
`<el-checkbox checked />`,
|
||||
() => ({}))
|
||||
expect(wrapper.find('.el-checkbox').classes().toString()).toMatch('is-checked')
|
||||
})
|
||||
|
||||
})
|
||||
|
@ -34,7 +34,7 @@ export const useCheckboxGroup = () => {
|
||||
}
|
||||
|
||||
const useModel = (props: ICheckboxProps) => {
|
||||
let selfModel = false
|
||||
const selfModel = ref(false)
|
||||
const { emit } = getCurrentInstance()
|
||||
const { isGroup, checkboxGroup } = useCheckboxGroup()
|
||||
const isLimitExceeded = ref(false)
|
||||
@ -43,7 +43,7 @@ const useModel = (props: ICheckboxProps) => {
|
||||
get() {
|
||||
return isGroup.value
|
||||
? store.value
|
||||
: props.modelValue ?? selfModel
|
||||
: props.modelValue ?? selfModel.value
|
||||
},
|
||||
|
||||
set(val: unknown) {
|
||||
@ -60,7 +60,7 @@ const useModel = (props: ICheckboxProps) => {
|
||||
isLimitExceeded.value === false && checkboxGroup?.changeEvent?.(val)
|
||||
} else {
|
||||
emit(UPDATE_MODEL_EVENT, val)
|
||||
selfModel = val as boolean
|
||||
selfModel.value = val as boolean
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user