From 14a11859bb2bf125cbfb5d856c6fe634dc1e16ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=99=93=E9=9D=99?= <17600756968@163.com> Date: Tue, 21 Jul 2020 16:24:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=9C=AC=E9=93=BE=E6=8E=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/base/edit/text-link/index.tsx | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/components/apolloTable/component/base/edit/text-link/index.tsx b/components/apolloTable/component/base/edit/text-link/index.tsx index fef9244..8141327 100644 --- a/components/apolloTable/component/base/edit/text-link/index.tsx +++ b/components/apolloTable/component/base/edit/text-link/index.tsx @@ -1,12 +1,13 @@ import React, { useEffect, useState } from 'react'; import { Input, Modal } from 'antd'; import styles from './styles.less'; +import { onBlurFn } from '../onBlurFn'; import { antiAssign } from '../../../../utils/utils'; import { ApolloTextAreaProps } from '../editInterface'; import { Consumer } from '../../../context'; export const ApolloTextLink = (props: ApolloTextAreaProps) => { - const { maxLength, onChange, value, cutLength, getDetail, rowData, onEmitChange, columnConfig, origin } = props; + const { maxLength, onChange, value, onEmitChange, columnConfig, origin } = props; const { columnChsName } = columnConfig; const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'value', 'cutLength', 'getDetail', 'rowData', 'onEmitChange']); const [curValue, setCurValue] = useState(value); @@ -17,12 +18,20 @@ export const ApolloTextLink = (props: ApolloTextAreaProps) => { getMore(); } }, [value]); + const [inputVal, setInputVal] = useState(value) + useEffect(() => { + setInputVal(value); + }, [value]); // useEffect(() => { // if (value && value.length === cutLength) { // getMore(); // } // }, []); - + const inputOnBlurFn = () => { + if (typeof onBlurFn === 'function') { + onBlurFn(props); + } + }; const changeValue = (e) => { if (typeof onChange === 'function') { onChange(e.target.value); @@ -62,8 +71,12 @@ export const ApolloTextLink = (props: ApolloTextAreaProps) => { { + changeValue(e); + setInputVal(e.target.value) + }} /> {!!maxLength && ( -- 2.21.0