在 Vue 2 中,Element UI 提供了 el-checkbox
和 el-checkbox-group
组件用于多选框功能。而在 Vue 3 中,Element UI 没有直接支持 Vue 3,但有一个名为 Element Plus 的项目提供了与 Element UI 类似但支持 Vue 3 的组件集。下面我将分别介绍 Vue 2 的 Element UI 和 Vue 3 的 Element Plus 中 el-checkbox
和 el-checkbox-group
组件的属性、事件和方法,并给出示例。
Vue 2 的 Element UI
el-checkbox
属性:
value
:多选框的值(在el-checkbox-group
中使用时)label
:多选框的 label(在el-checkbox-group
中使用时)disabled
:是否禁用多选框true-value
:选中时的值,默认为true
false-value
:未选中时的值,默认为false
border
:是否显示边框indeterminate
:设置 indeterminate 状态&#x