修改发布
This commit is contained in:
35
src/components/TitleTextarea/TitleTextarea.tsx
Normal file
35
src/components/TitleTextarea/TitleTextarea.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react'
|
||||
import { View } from '@tarojs/components'
|
||||
import { TextArea } from '@nutui/nutui-react-taro'
|
||||
import './index.scss'
|
||||
|
||||
interface TitleTextareaProps {
|
||||
value: string
|
||||
onChange: (value: string) => void
|
||||
maxLength?: number
|
||||
placeholder?: string
|
||||
}
|
||||
|
||||
const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
maxLength = 20,
|
||||
placeholder = '好的标题更吸引人哦'
|
||||
}) => {
|
||||
return (
|
||||
<View className='title-input-wrapper'>
|
||||
<TextArea
|
||||
className='title-input'
|
||||
placeholder={placeholder}
|
||||
value={value}
|
||||
onInput={(e) => onChange(e.detail.value)}
|
||||
maxlength={maxLength}
|
||||
autoSize={true}
|
||||
placeholderClass='title-input-placeholder'
|
||||
/>
|
||||
<View className='char-count'>{value.length}/{maxLength}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default TitleTextarea
|
||||
Reference in New Issue
Block a user