魏超 5 år sedan
förälder
incheckning
6e7c1ee1e3
1 ändrade filer med 1 tillägg och 14 borttagningar
  1. 1
    14
      src/components/SelectButton/BuildSelect.jsx

+ 1
- 14
src/components/SelectButton/BuildSelect.jsx Visa fil

@@ -22,12 +22,6 @@ function usePrevious(props) {
22 22
 const BuildingSelect = props => {
23 23
   const [data, setData] = useState([])
24 24
   const [value, setValue] = useState('')
25
-  const [disabled, setDisabled] = useState(false)
26
-  // const preProps = usePrevious(props)
27
-
28
-  // if ((!preProps) && props.value != value) {
29
-  //   setValue(props.value)
30
-  // }
31 25
 
32 26
   useEffect(() => {
33 27
     setValue(props.value)
@@ -35,7 +29,6 @@ const BuildingSelect = props => {
35 29
 
36 30
   useEffect(() => {
37 31
     getCityList();
38
-    setDisabledValue();
39 32
   }, [])
40 33
 
41 34
   const getCityList = e => {
@@ -49,12 +42,6 @@ const BuildingSelect = props => {
49 42
     })
50 43
   }
51 44
 
52
-  const setDisabledValue = () => {
53
-    if (props.disabled) {
54
-      setDisabled(props.disabled === true)
55
-    }
56
-  }
57
-
58 45
   const handleChange = e => {
59 46
     setValue(e)
60 47
     props.onChange(e)
@@ -62,12 +49,12 @@ const BuildingSelect = props => {
62 49
   // '' === value ? undefined : value
63 50
   return (
64 51
       <Select
52
+      {...props} 
65 53
       showSearch
66 54
       value={value}
67 55
       style={{ width: '180px' }}
68 56
       placeholder="请选择项目"
69 57
       onChange={handleChange}
70
-      disabled={disabled}
71 58
       filterOption={(input, option) =>
72 59
         option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
73 60
       }>