Browse Source

onChange放组件参数里面

visuddhinanda 3 years ago
parent
commit
a5bf1df9fa
1 changed files with 6 additions and 8 deletions
  1. 6 8
      dashboard/src/components/dict/SelectCase.tsx

+ 6 - 8
dashboard/src/components/dict/SelectCase.tsx

@@ -283,18 +283,16 @@ const Widget = ({ defaultValue, onCaseChange }: IWidget) => {
       children: case3_ti,
     },
   ];
-  const onChange = (value: (string | number)[]) => {
-    console.log("case changed", value);
-    if (typeof onCaseChange !== "undefined") {
-      onCaseChange(value);
-    }
-  };
-  console.log("case", defaultValue);
   return (
     <Cascader
       options={options}
       placeholder="Please select case"
-      onChange={onChange}
+      onChange={(value: (string | number)[]) => {
+        console.log("case changed", value);
+        if (typeof onCaseChange !== "undefined") {
+          onCaseChange(value);
+        }
+      }}
     />
   );
 };