4.6.201906031620 • Published 5 years ago

@dfeidao/fd-m000008 v4.6.201906031620

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

NumPwdBox密码输入框

https://dfeidao.gitee.io/widgets-mobile/

Installation

yarn add --dev @dfeidao/fd-m000008

属性

属性默认值类型描述
lengthnumber密码长度
titlestring支付窗口标题
tipstring提示文字
showboolean设置支付窗口显示
onCancelfunction用户取消事件
onCompletefunction用户输入完成

使用示例

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
		});
	}
}