Commit 54000886 authored by zhangwenshuai's avatar zhangwenshuai

弹框类组件修改为不同步数据

parent 6705ef2e
......@@ -22,15 +22,16 @@ export default function CellContainer<P extends Props>(Comp) {
};
this.container = React.createRef();
}
static getDerivedStateFromProps(nextProps: any, prevState: any) {
if (JSON.stringify(prevState.propsValue) !== JSON.stringify(nextProps.value)) {
return {
propsValue: nextProps.value,
value: nextProps.value,
};
}
return null;
}
// 编辑单元格实时更新
// static getDerivedStateFromProps(nextProps: any, prevState: any) {
// if (JSON.stringify(prevState.propsValue) !== JSON.stringify(nextProps.value)) {
// return {
// propsValue: nextProps.value,
// value: nextProps.value,
// };
// }
// return null;
// }
componentDidMount(): void {
document.addEventListener('click', this.onBlur, false);
}
......
......@@ -19,6 +19,7 @@ export const ApolloInput = (props: ApolloInputProps) => {
'maxPopHeight',
'getPopupContainer',
'getCalendarContainer',
'origin',
]);
const [inputVal, setInputVal] = useState(value);
useEffect(() => {
......
......@@ -13,6 +13,9 @@
:global(.ant-select-selection__rendered) {
width: 100%;
}
:global(.ant-select-dropdown-menu) {
max-height: none;
}
}
.searchDropdown {
overflow: auto;
......
......@@ -29,10 +29,9 @@ export const ApolloTextLink = (props: ApolloTextAreaProps) => {
const [visible, setVisible] = useState(false);
useEffect(() => {
if (origin !== 'editForm') {
setCurValue(value);
getMore();
}
}, [value]);
}, []);
const [inputVal, setInputVal] = useState(value);
useEffect(() => {
setInputVal(value);
......
......@@ -22,15 +22,15 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
'maxPopHeight',
'getPopupContainer',
'getCalendarContainer',
'origin',
]);
const [curValue, setCurValue] = useState(value);
const [visible, setVisible] = useState(false);
useEffect(() => {
if (origin !== 'editForm') {
setCurValue(value);
getMore();
}
}, [value]);
}, []);
const [inputVal, setInputVal] = useState(value);
useEffect(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment