index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
  2. import { use } from '../utils';
  3. import { emit, inherit } from '../utils/functional'; // Types
  4. var _use = use('password-input'),
  5. sfc = _use[0],
  6. bem = _use[1];
  7. function PasswordInput(h, props, slots, ctx) {
  8. var info = props.errorInfo || props.info;
  9. var Points = [];
  10. for (var i = 0; i < props.length; i++) {
  11. var _char = props.value[i];
  12. Points.push(h("li", {
  13. "class": "van-hairline"
  14. }, [props.mask ? h("i", {
  15. "style": {
  16. visibility: _char ? 'visible' : 'hidden'
  17. }
  18. }) : _char]));
  19. }
  20. return h("div", {
  21. "class": bem()
  22. }, [h("ul", _mergeJSXProps([{
  23. "class": [bem('security'), 'van-hairline--surround'],
  24. "on": {
  25. "touchstart": function touchstart(event) {
  26. event.stopPropagation();
  27. emit(ctx, 'focus', event);
  28. }
  29. }
  30. }, inherit(ctx, true)]), [Points]), info && h("div", {
  31. "class": bem(props.errorInfo ? 'error-info' : 'info')
  32. }, [info])]);
  33. }
  34. PasswordInput.props = {
  35. info: String,
  36. errorInfo: String,
  37. mask: {
  38. type: Boolean,
  39. "default": true
  40. },
  41. value: {
  42. type: String,
  43. "default": ''
  44. },
  45. length: {
  46. type: Number,
  47. "default": 6
  48. }
  49. };
  50. export default sfc(PasswordInput);