outaozhen 5 år sedan
förälder
incheckning
3a6ebb5f07

+ 9 - 2
src/components/EditableForm/editableFormItem.jsx

@@ -9,6 +9,7 @@ const EditableFormItem = ({ label, dataIndex, record, dataId, span, editCellType
   const [editing, setEditing] = useState(false)
   const inputRef = useRef(null)
   const [val, setVal] = useState('')
+  const { Option } = Select
   useEffect(() => {
     setVal('')
   }, [])
@@ -49,6 +50,10 @@ const EditableFormItem = ({ label, dataIndex, record, dataId, span, editCellType
     toggleEdit()
   }
 
+  function handleSelectChange(value) {
+    console.log(`selected ${value}`)
+  }
+
   // const handleOnChange = e => {
   //   setVal(value)
   //   const { value = '' } = e.currentTarget
@@ -65,9 +70,11 @@ const EditableFormItem = ({ label, dataIndex, record, dataId, span, editCellType
         cell = (
           <Select
             defaultValue="男"
+            onBlur={save}
+            onChange={handleSelectChange}
           >
-            <option vlaue="男">男</option>
-            <option vlaue="女">女</option>
+            <Option vlaue="男">男</Option>
+            <Option vlaue="女">女</Option>
           </Select>
         )
         break

+ 1 - 0
src/components/PopContent/Contacts/ContanctForm.jsx

@@ -20,6 +20,7 @@ const ContanctForm = props => {
     {
       dataIndex: 'gender',
       label: '性别',
+      editCellType: 'select',
       span: 12
     },
     {