fix(CheckboxField): 修复默认值为空时的初始化问题
当component_props.default未定义时,将checkbox_value初始化为空数组以避免潜在错误
Showing
1 changed file
with
2 additions
and
2 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-08-30 11:34:19 | 2 | * @Date: 2022-08-30 11:34:19 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-06-10 14:21:45 | 4 | + * @LastEditTime: 2025-06-10 14:38:18 |
| 5 | * @FilePath: /data-table/src/components/CheckboxField/index.vue | 5 | * @FilePath: /data-table/src/components/CheckboxField/index.vue |
| 6 | * @Description: 多项选择控件 | 6 | * @Description: 多项选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -94,7 +94,7 @@ const validatorMessage = (val, rule) => { | ... | @@ -94,7 +94,7 @@ const validatorMessage = (val, rule) => { |
| 94 | const rules = [{ validator, message: validatorMessage }]; | 94 | const rules = [{ validator, message: validatorMessage }]; |
| 95 | 95 | ||
| 96 | const emit = defineEmits(["active"]); | 96 | const emit = defineEmits(["active"]); |
| 97 | -const checkbox_value = ref(props.item.component_props?.default); | 97 | +const checkbox_value = ref(props.item.component_props?.default ? props.item.component_props?.default : []); |
| 98 | const affix_value = ref({}); | 98 | const affix_value = ref({}); |
| 99 | 99 | ||
| 100 | const onClick = (item) => { | 100 | const onClick = (item) => { | ... | ... |
-
Please register or login to post a comment