翼度科技»论坛 编程开发 html5 查看内容

前端Vue自定义支付密码输入键盘Keyboard和支付设置输入框Input

7

主题

7

帖子

21

积分

新手上路

Rank: 1

积分
21
前端Vue自定义支付密码输入键盘Keyboard和支付设置输入框Input, 下载完整代码请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13166

效果图如下:





cc-defineKeyboard

使用方法
  1. <cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo"></cc-defineKeyboard>
  2. /** * 唤起键盘 */
  3. onPayUp() {
  4. this.$refs.CodeKeyboard.show();
  5. },
  6. /*** 支付键盘回调* @param {Object} val */
  7. KeyInfo(val) {
  8. if (val.index >= 6) {
  9. return;
  10. }
  11. // 判断是否输入的是删除键
  12. if (val.keyCode === 8) {
  13. // 删除最后一位
  14. this.passwordArr.splice(val.index + 1, 1)
  15. }
  16. // 判断是否输入的是.
  17. else if (val.keyCode == 190) {
  18. // 输入.无效
  19. } else {
  20. this.passwordArr.push(val.key);
  21. }
  22. uni.showModal({
  23. title: '温馨提示',
  24. content: '输入密码是 = ' + JSON.stringify(this.passwordArr)
  25. })
  26. }
复制代码
HTML代码实现部分
  1. <template>
  2. <view >
  3. <view>
  4. <view >
  5. <text v-show="AffirmStatus === 1">请输入6位支付密码</text>
  6. <text v-show="AffirmStatus === 2">请设置6位支付密码</text>
  7. <text v-show="AffirmStatus === 3">请确认6位支付密码</text>
  8. </view>
  9. <view  @click="onPayUp">
  10. <view >
  11. <text v-show="passwordArr.length >= 1">●</text>
  12. </view>
  13. <view >
  14. <text v-show="passwordArr.length >= 2">●</text>
  15. </view>
  16. <view >
  17. <text v-show="passwordArr.length >= 3">●</text>
  18. </view>
  19. <view >
  20. <text v-show="passwordArr.length >= 4">●</text>
  21. </view>
  22. <view >
  23. <text v-show="passwordArr.length >= 5">●</text>
  24. </view>
  25. <view >
  26. <text v-show="passwordArr.length >= 6">●</text>
  27. </view>
  28. </view>
  29. <view >
  30. <text>忘记支付密码?</text>
  31. </view>
  32. </view>
  33. <cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo"></cc-defineKeyboard>
  34. </view>
  35. </template>
复制代码
来源:https://www.cnblogs.com/ccVue/p/17498718.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

举报 回复 使用道具