This commit is contained in:
张成
2025-11-09 23:22:12 +08:00

View File

@@ -1,6 +1,7 @@
import React from 'react'
import React, { useCallback } from 'react'
import { View } from '@tarojs/components'
import { TextArea } from '@nutui/nutui-react-taro'
import { TextArea } from '@nutui/nutui-react-taro';
import './index.scss'
interface TitleTextareaProps {
@@ -20,14 +21,22 @@ const TitleTextarea: React.FC<TitleTextareaProps> = ({
onFocus,
onBlur
}) => {
const handleChange = useCallback((values) => {
if (values.length > maxLength ) {
const newValues = values.slice(0, maxLength)
onChange(newValues)
return;
}
onChange(values)
}, [])
return (
<View className='title-input-wrapper'>
<TextArea
className='title-input'
placeholder={placeholder}
value={value}
onInput={(e) => onChange(e.detail.value)}
maxlength={maxLength}
onInput={(e) => handleChange(e.detail.value)}
// maxlength={maxLength}
autoSize={true}
placeholderClass='title-input-placeholder'
onFocus={onFocus}