index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. exports.__esModule = true;
  4. exports["default"] = void 0;
  5. var _utils = require("../utils");
  6. var _color = require("../utils/color");
  7. var _icon = _interopRequireDefault(require("../icon"));
  8. var _use = (0, _utils.use)('steps'),
  9. sfc = _use[0],
  10. bem = _use[1];
  11. var _default = sfc({
  12. props: {
  13. icon: String,
  14. title: String,
  15. active: Number,
  16. iconClass: String,
  17. description: String,
  18. direction: {
  19. type: String,
  20. "default": 'horizontal'
  21. },
  22. activeColor: {
  23. type: String,
  24. "default": _color.GREEN
  25. },
  26. activeIcon: {
  27. type: String,
  28. "default": 'checked'
  29. }
  30. },
  31. data: function data() {
  32. return {
  33. steps: []
  34. };
  35. },
  36. render: function render(h) {
  37. var icon = this.icon,
  38. title = this.title,
  39. description = this.description,
  40. slots = this.slots;
  41. var StatusIcon = (slots('icon') || icon) && h("div", {
  42. "class": bem('icon')
  43. }, [slots('icon') || h(_icon["default"], {
  44. "attrs": {
  45. "name": icon
  46. },
  47. "class": this.iconClass
  48. })]);
  49. var StatusMessage = h("div", {
  50. "class": bem('message')
  51. }, [h("div", {
  52. "class": bem('title')
  53. }, [title]), h("div", {
  54. "class": [bem('desc'), 'van-ellipsis']
  55. }, [description])]);
  56. return h("div", {
  57. "class": bem([this.direction])
  58. }, [(title || description) && h("div", {
  59. "class": bem('status')
  60. }, [StatusIcon, StatusMessage, slots('message-extra')]), h("div", {
  61. "class": bem('items', {
  62. alone: !title && !description
  63. })
  64. }, [slots()])]);
  65. }
  66. });
  67. exports["default"] = _default;