验证弹窗

需要加载的模块

  1. const eeui = app.requireModule('eeui');

eeui.swipeCaptcha

显示滑动验证码弹窗

预览效果

验证弹窗 - 图1

  1. /**
  2. * @param imgUrl 自定义显示的图片
  3. * @param callback 回调事件
  4. */
  5. eeui.swipeCaptcha(imgUrl, callback(result))

示例代码

  1. <template>
  2. <div class="app">
  3. <text class="button" @click="swipeCaptcha">打开验证</text>
  4. </div>
  5. </template>
  6. <style>
  7. .app {
  8. flex: 1;
  9. justify-content: center;
  10. align-items: center;
  11. }
  12. .button {
  13. text-align: center;
  14. margin-top: 20px;
  15. padding-top: 20px;
  16. padding-bottom: 20px;
  17. padding-left: 30px;
  18. padding-right: 30px;
  19. color: #ffffff;
  20. background-color: #00B4FF;
  21. }
  22. </style>
  23. <script>
  24. const eeui = app.requireModule('eeui');
  25. export default {
  26. methods: {
  27. swipeCaptcha() {
  28. eeui.swipeCaptcha("", (res)=>{
  29. switch (res.status) {
  30. case "success":
  31. eeui.toast("验证成功");
  32. break;
  33. case "failed":
  34. eeui.toast("验证失败");
  35. break;
  36. }
  37. });
  38. },
  39. }
  40. };
  41. </script>

imgUrl 参数说明

类型 必须 描述 默认值
String - 自定义显示的图片 -

callback 回调result说明

  1. {
  2. pageName: '页面名称',
  3. status: 'create', //状态,详见:注①
  4. }

注①:

  • create页面创建完毕
  • destroy页面已销毁
  • success验证成功
  • failed验证失败

简单示例

  1. //示例①
  2. eeui.swipeCaptcha("", function(result) {
  3. //......
  4. });
  5. //示例②
  6. eeui.swipeCaptcha('http://...../captcha.png', function(result) {
  7. //......
  8. });