# amountinputtext **Repository Path**: openharmony-sig/amountinputtext ## Basic Information - **Project Name**: amountinputtext - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 3 - **Created**: 2022-09-22 - **Last Updated**: 2025-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🚨 **重要提示 | IMPORTANT** > > **⚠️ 此代码仓已归档。新地址请访问 [amountinputtext](https://gitcode.com/openharmony-sig/amountinputtext)。| ⚠️ This repository has been archived. For the new address, please visit [amountinputtext](https://gitcode.com/openharmony-sig/amountinputtext).** > --- > # amountinputtext ## 简介 >amountinputtext是一款金额输入组件,带有金融业专用版数字键盘,具有如下特点: 1、简洁: 金额组件自带金额输入键盘,相比于系统键盘更简洁,只保留了金额相关输入键,界面更简单明了; 2、专业:支持人民币、美元、日元等常用币种的输入,组件根据选择的币种自行配置; 3、灵活:金额键盘提供了多套模板,满足目前市面上安卓端主流金额输入键盘的样式需求;支持键盘乱序、自定义标题等动态化配置; 4、安全:数据未进行网络传输及本地存储,所输入的内容不会被捕捉,相比于系统输入法,更加安全; ## 效果展示 标准版 ![img](screenshot/normal.png) 4X4版 ![img](screenshot/view4x4.png) ## 使用说明(基础配置) 1、定义model: ``` model: AmountInputText.Model = new AmountInputText.Model(); ``` 2、输入框相关设置 ``` this.model.setDefTips("点此输入金额"); //默认提示信息 this.model.setCurrency(CurrencyCode.CNY); //设置输入的币种, 默认是人民币 ``` 3、键盘相关设置 ``` let keyboardModel = new KeyboardViewAttributeModel(); keyboardModel.setKeyboardViewType(KeyboardViewType.VIEW4X4) //使用默认键盘 keyboardModel.setIsShowKeyboardTitle(false) //是否显示键盘标题 keyboardModel.setIsBorderRadius(true) //是否圆角模式 this.model.setKeyboardModel(keyboardModel) ``` 带标题 ![img](screenshot/normal_title.png) 圆角 ![img](screenshot/normal_round.png) ## 其他配置项说明 •输入框支持的配置项 ``` currency = CurrencyCode.CNY; //币种,默认人民币 showCurrencySymbol = true; //是否显示币种符号,默认显示 currencySymbol = CurrencyManager.getCurrencySymbol(this.currency); width = "100%"; //组件宽度 height = 30; //组件高度 textColor = $r('app.color.color_font_red'); //文字颜色 textSize = 24; //字体大小 symbolSize = 20; //币种符号大小 defTips: string = "请输入金额"; //默认提示语 amountStr: string = ""; //当前金额 supportDot: boolean = true; //是否支持小数点 maxLeftNumCount: number = 11; //小数点左边最大数字长度 maxRightNumCount: number = 2; //小数点右边最大数字长度 ``` •键盘相关配置 ``` /** * 单个键是否使用圆角,默认否 */ isBorderRadius: boolean = false /** * 键盘类型,默认使用4行3列模式 */ keyboardViewType: KeyboardViewType = KeyboardViewType.NORMAL /** * 是否显示键盘标题 */ isShowKeyboardTitle = false; ``` •键盘类型 ``` /** * 普通数字类型, 4行3列 */ NORMAL, /** * 数字类型, 4行4列类型 */ VIEW4X4, ``` •常用币种 ``` CNY, //人民币元 GBP, //英镑 HKD, //港币 USD, //美元 JPY, //日元 CAD, //加拿大元 AUD, //澳大利亚元 EUR //欧元 ``` ## 兼容性 支持 OpenHarmony API version 7 及以上版本。 ## 目录结构 ``` |---- amountinputtext | |---- entry # 示例代码文件夹 | |---- liabamountinput # amountinput库文件夹 | |----model # 数据相关 | |----AmountInputData # 金额输入数据,包含 0-9. 等 | |----CurrencyCode # 常用币种code | |----CurrencyModel # 币种model | |----DialogAttributeModel # 弹框属性 | |----KeyboardViewAttributeModel # 键盘常用属性 | |----widget # UI组件 | |----AmountInputText # 金额输入组件 | |----AmountInputDialog # 金额键盘dialog | |----AmountInputKeyboardView # 金额键盘View | |----AmountInputCallback # 键盘回调 | |----AmountInputKeyboardTitleView # 键盘标题View | |----utils # 工具类 | |----CurrencyManager # 常用币种管理 | |---- index.ts # 对外接口 | |---- README.MD # 安装使用方法 ``` ## 贡献代码 使用过程中发现任何问题都可以提 [Issue](https://gitee.com/bocmbci-test/amountinputtext/issues) 给我们,当然,我们也非常欢迎你给我们发 [PR](https://gitee.com/bocmbci-test/amountinputtext/pulls) 。