This commit is contained in:
张成
2025-09-07 20:12:54 +08:00
parent 45f85a8572
commit fa0dc5bbd7
5 changed files with 217 additions and 75 deletions

View File

@@ -1,11 +1,12 @@
import React, { useState, useEffect } from 'react';
import { View, Text, Textarea, Button } from '@tarojs/components';
import { View, Text, Textarea, Input, Picker } from '@tarojs/components';
import Taro from '@tarojs/taro';
import './EditModal.scss';
interface EditModalProps {
visible: boolean;
title: string;
type: string;
placeholder: string;
initialValue: string;
maxLength: number;
@@ -17,6 +18,7 @@ interface EditModalProps {
const EditModal: React.FC<EditModalProps> = ({
visible,
title,
type,
placeholder,
initialValue,
maxLength,
@@ -82,17 +84,34 @@ const EditModal: React.FC<EditModalProps> = ({
<View className="modal_content">
{/* 文本输入区域 */}
<View className="input_container">
<Textarea
className="text_input"
{type === 'nickname' ? (
<Input
className="text_input nickname_input"
value={value}
type="nickname"
placeholder={placeholder}
maxlength={maxLength}
onInput={handle_input_change}
adjustPosition={true}
confirmType="done"
autoFocus={true}
/>
<View className="char_count">
<Text className="count_text">{value.length}/{maxLength}</Text>
</View>
) : (
<>
<Textarea
className="text_input"
value={value}
placeholder={placeholder}
maxlength={maxLength}
onInput={handle_input_change}
autoFocus={true}
/>
<View className="char_count">
<Text className="count_text">{value.length}/{maxLength}</Text>
</View>
</>
)}
</View>
{/* 验证提示 */}