Explorar el Código

供应商下拉框点开后刷新

xujunjie hace 1 año
padre
commit
ab63492087
Se han modificado 1 ficheros con 6 adiciones y 4 borrados
  1. 6 4
      src/components/DDComponents/ManufacturerField/index.js

+ 6 - 4
src/components/DDComponents/ManufacturerField/index.js

@@ -30,10 +30,10 @@ function ManufacturerField(props) {
     setLoading(false);
   };
 
-  // 只要第一次加载即可
-  useEffect(() => {
-    getSupplier();
-  }, []);
+  // // 只要第一次加载即可
+  // useEffect(() => {
+  //   getSupplier();
+  // }, []);
 
   return (
     <Select
@@ -46,6 +46,8 @@ function ManufacturerField(props) {
         const supplier = option.find(item => item.value === val).label;
         onChange(supplier);
       }}
+      // 每次展开刷新一次数据
+      onDropdownVisibleChange={open => open && getSupplier()}
       filterOption={(input, opt) => (opt?.label ?? '').toLowerCase().includes(input.toLowerCase())}
       options={option}
     />