Steps.mjs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { createVNode as _createVNode } from "vue";
  2. import { defineComponent } from "vue";
  3. import { makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
  4. import { useChildren } from "@vant/use";
  5. const [name, bem] = createNamespace("steps");
  6. const stepsProps = {
  7. active: makeNumericProp(0),
  8. direction: makeStringProp("horizontal"),
  9. activeIcon: makeStringProp("checked"),
  10. iconPrefix: String,
  11. finishIcon: String,
  12. activeColor: String,
  13. inactiveIcon: String,
  14. inactiveColor: String
  15. };
  16. const STEPS_KEY = Symbol(name);
  17. var stdin_default = defineComponent({
  18. name,
  19. props: stepsProps,
  20. emits: ["clickStep"],
  21. setup(props, {
  22. emit,
  23. slots
  24. }) {
  25. const {
  26. linkChildren
  27. } = useChildren(STEPS_KEY);
  28. const onClickStep = (index) => emit("clickStep", index);
  29. linkChildren({
  30. props,
  31. onClickStep
  32. });
  33. return () => {
  34. var _a;
  35. return _createVNode("div", {
  36. "class": bem([props.direction])
  37. }, [_createVNode("div", {
  38. "class": bem("items")
  39. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
  40. };
  41. }
  42. });
  43. export {
  44. STEPS_KEY,
  45. stdin_default as default,
  46. stepsProps
  47. };