林凡 5 years ago
parent
commit
f38a885bae
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      src/components/SelectButton/CitySelect.jsx

+ 2
- 3
src/components/SelectButton/CitySelect.jsx View File

16
 
16
 
17
   useEffect(() => {
17
   useEffect(() => {
18
     getCityList();
18
     getCityList();
19
-    
19
+    getValue();
20
   },[props.value])
20
   },[props.value])
21
 
21
 
22
   const getCityList = (e) => {
22
   const getCityList = (e) => {
27
         action: 'select',
27
         action: 'select',
28
     }).then((data) => {
28
     }).then((data) => {
29
         setData(data)
29
         setData(data)
30
-        getValue(data);
31
     })
30
     })
32
   }
31
   }
33
 
32
 
34
   /**
33
   /**
35
    * 因为 有个需求是,如果这个城市被删除了,那么就直接展示为空,不能展示 cityId
34
    * 因为 有个需求是,如果这个城市被删除了,那么就直接展示为空,不能展示 cityId
36
    */
35
    */
37
-  const getValue = (data) => {
36
+  const getValue = () => {
38
     if (props.value) {
37
     if (props.value) {
39
       const tempData = data.filter(f => f.id == props.value)
38
       const tempData = data.filter(f => f.id == props.value)
40
       const va = (tempData.length > 0) ? props.value : undefined
39
       const va = (tempData.length > 0) ? props.value : undefined