Browse Source

修改表单值的设置

ymy 2 years ago
parent
commit
a2fd998e10
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/benyun/components/byForm/byForm.vue

+ 5 - 5
src/benyun/components/byForm/byForm.vue

@@ -177,11 +177,11 @@ export default class ByForm extends VueViews {
   //设置下级组件值
   //设置下级组件值
   setChildrenComValue(){
   setChildrenComValue(){
     if(this.value){
     if(this.value){
-      for(const key in this.value){
-        const code = key +'Comp';
-        if((this as any).$refs[code] && (this as any).$refs[code][0] && (this as any).$refs[code][0].setValue){
-        (this as any).$refs[code][0].setValue(this.value[key])
-      }
+      for(const key in (this as any).$refs){
+        if(key.indexOf('Comp') >= 0 && (this as any).$refs[key] && (this as any).$refs[key][0] && (this as any).$refs[key][0].setValue){
+          const code = key.split('Comp')[0];
+          (this as any).$refs[key][0].setValue(this.value[code])
+        }
       }
       }
     }
     }
   }
   }