4.6.201906031620 • Published 6 years ago
@dfeidao/fd-m000008 v4.6.201906031620
NumPwdBox密码输入框
https://dfeidao.gitee.io/widgets-mobile/
Installation
yarn add --dev @dfeidao/fd-m000008属性
| 属性 | 默认值 | 类型 | 描述 | 
|---|---|---|---|
| length | 无 | number | 密码长度 | 
| title | 无 | string | 支付窗口标题 | 
| tip | 无 | string | 提示文字 | 
| show | 无 | boolean | 设置支付窗口显示 | 
| onCancel | 无 | function | 用户取消事件 | 
| onComplete | 无 | function | 用户输入完成 | 
使用示例
tpl.tsx
export default function tpl(...) {
	const show = d('show') as unknown as boolean;
	const tip = d('tip') as string;
	return (
		<View>
			<Text onPress={a('a001')}>
				点击支付
			</Text>
			<NumPwdBox
				length={6}
				title={'请输入密码!'}
				onCancel={a('a002')}
				onComplete={a('a003')}
				show={show}
				tip={tip}
			>
			</NumPwdBox>
		</View>
	);
}a001.ts
export default async function a001(fd: IFeidaoAiMobile) {
	render(fd, {
		show: true,
		tip: ''
	});
}a002.ts
export default async function a002(fd: IFeidaoAiMobile) {
	render(fd, {
		show: false
	});
}a003.ts
export default async function a003(fd: IFeidaoAiMobile, e: string) {
	console.log('用户输入的密码: ', e);
	if (/** 密码错误 **/) {
		render(fd, {
			tip: '密码输入错误,请重新输入'
		});
	} else {
		render(fd, {
			show: false
		});
	}
}4.6.201906031620
6 years ago