Browse Source

fix(form): fix the form item setting not taking effect

vben 4 years ago
parent
commit
6936adb2c2
2 changed files with 4 additions and 2 deletions
  1. 1 0
      CHANGELOG.zh_CN.md
  2. 3 2
      src/components/Form/src/FormItem.tsx

+ 1 - 0
CHANGELOG.zh_CN.md

@@ -17,6 +17,7 @@
 - 修复升级之后 table 类型问题
 - 修复分割菜单且左侧菜单没有数据时候,继续展示上一次子菜单的问题
 - 修复`useMessage`类型问题
+- 修复表单项设置`disabled`不生效问题
 
 ## 2.0.0-rc.8 (2020-11-2)
 

+ 3 - 2
src/components/Form/src/FormItem.tsx

@@ -56,8 +56,9 @@ export default defineComponent({
 
     const getDisableRef = computed(() => {
       const { disabled: globDisabled } = props.formProps;
-      const { dynamicDisabled } = props.schema;
-      let disabled = !!globDisabled;
+      const { dynamicDisabled, componentProps = {} } = props.schema;
+      const { disabled: itemDisabled = false } = componentProps;
+      let disabled = !!globDisabled || itemDisabled;
       if (isBoolean(dynamicDisabled)) {
         disabled = dynamicDisabled;
       }