修改弹窗

This commit is contained in:
筱野
2025-11-24 23:30:27 +08:00
parent 78ab8c9a42
commit 8e558ac57f
9 changed files with 79 additions and 18 deletions

View File

@@ -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>
)
}

View File

@@ -41,5 +41,8 @@
font-size: 14px;
font-weight: 400;
line-height: 24px;
&.char-count--error {
color: #ff4d4f;
}
}
}