Steps.mjs 1.1 KB

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