Commit 14a11859 authored by 李晓静's avatar 李晓静

文本链接修改

parent b37a74f0
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) => {
<Input.TextArea
className={styles.inputForm}
{...selfProps}
value={value}
onChange={changeValue}
value={inputVal}
onBlur={inputOnBlurFn}
onChange={(e) => {
changeValue(e);
setInputVal(e.target.value)
}}
/>
{!!maxLength && (
<span className={styles.wordNumberForm}>
......
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