forked from Gitlink/forgeplus-react
56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
import React , { forwardRef, useEffect } from 'react';
|
|
import {Form , Modal , Input } from 'antd';
|
|
import "./sub.scss";
|
|
const { TextArea } = Input;
|
|
function UpdateDescModal({form , visible , onCancel , onOk,desc,website}){
|
|
const { getFieldDecorator, validateFields , setFieldsValue } = form;
|
|
|
|
useEffect(()=>{
|
|
if(desc || website){
|
|
setFieldsValue({
|
|
website,desc
|
|
})
|
|
}
|
|
},[desc,website])
|
|
|
|
function onSure(){
|
|
validateFields((err,values)=>{
|
|
if(!err){
|
|
onCancel();
|
|
onOk(values.desc,values.website)
|
|
}
|
|
})
|
|
}
|
|
return(
|
|
<Modal
|
|
title={"修改信息"}
|
|
closable={false}
|
|
visible={visible}
|
|
centered
|
|
onCancel={onCancel}
|
|
onOk={onSure}
|
|
okText="确定"
|
|
cancelText="取消"
|
|
width="400px"
|
|
className={"descmodal"}
|
|
>
|
|
<Form>
|
|
<Form.Item label="仓库描述">
|
|
{getFieldDecorator("desc",{
|
|
rules:[]
|
|
})(
|
|
<TextArea placeholder="仓库描述" rows={4} maxLength={200}/>
|
|
)}
|
|
</Form.Item>
|
|
<Form.Item label="website">
|
|
{getFieldDecorator("website",{
|
|
rules:[]
|
|
})(
|
|
<Input placeholder="website链接"/>
|
|
)}
|
|
</Form.Item>
|
|
</Form>
|
|
</Modal>
|
|
)
|
|
}
|
|
export default Form.create()(forwardRef(UpdateDescModal)); |