Steps.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. var __defProp = Object.defineProperty;
  2. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  3. var __getOwnPropNames = Object.getOwnPropertyNames;
  4. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5. var __export = (target, all) => {
  6. for (var name2 in all)
  7. __defProp(target, name2, { get: all[name2], enumerable: true });
  8. };
  9. var __copyProps = (to, from, except, desc) => {
  10. if (from && typeof from === "object" || typeof from === "function") {
  11. for (let key of __getOwnPropNames(from))
  12. if (!__hasOwnProp.call(to, key) && key !== except)
  13. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  14. }
  15. return to;
  16. };
  17. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  18. var stdin_exports = {};
  19. __export(stdin_exports, {
  20. STEPS_KEY: () => STEPS_KEY,
  21. default: () => stdin_default,
  22. stepsProps: () => stepsProps
  23. });
  24. module.exports = __toCommonJS(stdin_exports);
  25. var import_vue = require("vue");
  26. var import_vue2 = require("vue");
  27. var import_utils = require("../utils");
  28. var import_use = require("@vant/use");
  29. const [name, bem] = (0, import_utils.createNamespace)("steps");
  30. const stepsProps = {
  31. active: (0, import_utils.makeNumericProp)(0),
  32. direction: (0, import_utils.makeStringProp)("horizontal"),
  33. activeIcon: (0, import_utils.makeStringProp)("checked"),
  34. iconPrefix: String,
  35. finishIcon: String,
  36. activeColor: String,
  37. inactiveIcon: String,
  38. inactiveColor: String
  39. };
  40. const STEPS_KEY = Symbol(name);
  41. var stdin_default = (0, import_vue2.defineComponent)({
  42. name,
  43. props: stepsProps,
  44. emits: ["clickStep"],
  45. setup(props, {
  46. emit,
  47. slots
  48. }) {
  49. const {
  50. linkChildren
  51. } = (0, import_use.useChildren)(STEPS_KEY);
  52. const onClickStep = (index) => emit("clickStep", index);
  53. linkChildren({
  54. props,
  55. onClickStep
  56. });
  57. return () => {
  58. var _a;
  59. return (0, import_vue.createVNode)("div", {
  60. "class": bem([props.direction])
  61. }, [(0, import_vue.createVNode)("div", {
  62. "class": bem("items")
  63. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  64. };
  65. }
  66. });