diff --git a/package/component/src/component/checkbox/index.vue b/package/component/src/component/checkbox/index.vue index 8f896711..25475c37 100644 --- a/package/component/src/component/checkbox/index.vue +++ b/package/component/src/component/checkbox/index.vue @@ -12,7 +12,8 @@ import "./index.less"; export interface LayCheckboxProps { name?: string; skin?: string; - label: string | object; + value: string | object; + label?: string; isIndeterminate?: boolean; modelValue?: boolean | Array; disabled?: boolean; @@ -22,6 +23,7 @@ const props = withDefaults(defineProps(), { isIndeterminate: false, modelValue: false, disabled: false, + label:'' }); const checkboxGroup: any = inject("checkboxGroup", {}); @@ -37,10 +39,10 @@ const emit = defineEmits(["update:modelValue", "change"]); const isChecked = computed({ get() { if (isGroup.value) { - return checkboxGroup.modelValue.value.includes(props.label); + return checkboxGroup.modelValue.value.includes(props.value); } else { if (Array.isArray(props.modelValue)) { - return props.modelValue.includes(props.label); + return props.modelValue.includes(props.value); } else { return props.modelValue; } @@ -71,9 +73,9 @@ const arrayModelValue = computed(() => { const setGroupModelValue = function (checked: any) { let groupModelValue = [...checkboxGroup.modelValue.value]; if (!checked) { - groupModelValue.splice(groupModelValue.indexOf(props.label), 1); + groupModelValue.splice(groupModelValue.indexOf(props.value), 1); } else { - groupModelValue.push(props.label); + groupModelValue.push(props.value); } checkboxGroup.modelValue.value = groupModelValue; }; @@ -81,9 +83,9 @@ const setGroupModelValue = function (checked: any) { const setArrayModelValue = function (checked: any) { let arr = [...arrayModelValue.value]; if (!checked) { - arr.splice(arr.indexOf(props.label), 1); + arr.splice(arr.indexOf(props.value), 1); } else { - arr.push(props.label); + arr.push(props.value); } emit("change", arr); emit("update:modelValue", arr); @@ -98,7 +100,7 @@ const handleClick = function () { {{ label }} diff --git a/package/component/src/component/table/TableRow.vue b/package/component/src/component/table/TableRow.vue index c03ce9c1..830a1de1 100644 --- a/package/component/src/component/table/TableRow.vue +++ b/package/component/src/component/table/TableRow.vue @@ -181,7 +181,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => {
diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index 58422f9b..dff64ee0 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -316,7 +316,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { v-model="tableColumnKeys" skin="primary" :key="column.key" - :label="column.key" + :value="column.key" >{{ column.title }} @@ -365,7 +365,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { v-model="hasChecked" :is-indeterminate="!allChecked" skin="primary" - label="all" + value="all" @change="changeAll" /> diff --git a/package/component/src/component/tree/TreeNode.vue b/package/component/src/component/tree/TreeNode.vue index 9dac0b1b..d6b2297f 100644 --- a/package/component/src/component/tree/TreeNode.vue +++ b/package/component/src/component/tree/TreeNode.vue @@ -152,7 +152,7 @@ const isChildAllSelected = computed(() => { :modelValue="node.isChecked" :disabled="node.isDisabled" skin="primary" - label="" + value="" @change=" (checked) => { handleChange(checked, node); diff --git a/package/document-component/src/document/zh-CN/components/checkbox.md b/package/document-component/src/document/zh-CN/components/checkbox.md index 35151608..24c5f983 100644 --- a/package/document-component/src/document/zh-CN/components/checkbox.md +++ b/package/document-component/src/document/zh-CN/components/checkbox.md @@ -13,7 +13,10 @@ ::: demo 使用 `lay-checkbox` 标签, 创建一个复选框