taro + react 使用的是taro的组件AtInput 问题:小程序手机会出现光标前置到首位。 解决方法: 少数使用AtInput,在上面直接添加 cursor={-1}。 <AtInput cursor={-1} /> 大量使用则封装套一层。 import { AtInput } from 'taro-ui'; const CustomAtInput = (props) => { // 默认的固定参数 const fixedProps = { cursor: -1 }; // 将固定的属性与传入的属性合并 const newProps = { ...fixedProps, ...props }; return <AtInput {...newProps} />; }; export {CustomAtInput}; // 其他使用的组件重命名为AtInput import { CustomAtInput as AtInput} from "@/components/CustomerInput"
为什么在一些手机上输入框的光标一直在前面?问题描述:在登录界面,输入账号密码时光标一直定位在前面,导致输入的数据是反过来的 使用的是taro + react, 用的是taro的组件<AtInput />手机信息 [图片][图片] 代码: formSubmit(e, 1)} onReset={formReset}> { setLoginName(e) }} > { setPasswd(e) }} value={passwd} > {passwd ? { setPasswd("") }} /> : } { setPasswdVisible(!passwdVisible) }} /> 登录
02-28