修改弹窗
This commit is contained in:
@@ -21,12 +21,13 @@ const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
||||
onFocus,
|
||||
onBlur
|
||||
}) => {
|
||||
const isOverflow = value.length > maxLength
|
||||
const handleChange = useCallback((values) => {
|
||||
if (values.length > maxLength ) {
|
||||
const newValues = values.slice(0, maxLength)
|
||||
onChange(newValues)
|
||||
return;
|
||||
}
|
||||
// if (values.length > maxLength ) {
|
||||
// const newValues = values.slice(0, maxLength)
|
||||
// onChange(newValues)
|
||||
// return;
|
||||
// }
|
||||
onChange(values)
|
||||
}, [])
|
||||
return (
|
||||
@@ -42,7 +43,9 @@ const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
||||
onFocus={onFocus}
|
||||
onBlur={onBlur}
|
||||
/>
|
||||
<View className='char-count'>{value.length}/{maxLength}</View>
|
||||
<View className={`char-count${isOverflow ? ' char-count--error' : ''}`}>
|
||||
{value.length}/{maxLength}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,5 +41,8 @@
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 24px;
|
||||
&.char-count--error {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user