ActionBar.mjs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { createVNode as _createVNode } from "vue";
  2. import { defineComponent, ref } from "vue";
  3. import { truthProp, createNamespace } from "../utils/index.mjs";
  4. import { useChildren } from "@vant/use";
  5. import { usePlaceholder } from "../composables/use-placeholder.mjs";
  6. const [name, bem] = createNamespace("action-bar");
  7. const ACTION_BAR_KEY = Symbol(name);
  8. const actionBarProps = {
  9. placeholder: Boolean,
  10. safeAreaInsetBottom: truthProp
  11. };
  12. var stdin_default = defineComponent({
  13. name,
  14. props: actionBarProps,
  15. setup(props, {
  16. slots
  17. }) {
  18. const root = ref();
  19. const renderPlaceholder = usePlaceholder(root, bem);
  20. const {
  21. linkChildren
  22. } = useChildren(ACTION_BAR_KEY);
  23. linkChildren();
  24. const renderActionBar = () => {
  25. var _a;
  26. return _createVNode("div", {
  27. "ref": root,
  28. "class": [bem(), {
  29. "van-safe-area-bottom": props.safeAreaInsetBottom
  30. }]
  31. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  32. };
  33. return () => {
  34. if (props.placeholder) {
  35. return renderPlaceholder(renderActionBar);
  36. }
  37. return renderActionBar();
  38. };
  39. }
  40. });
  41. export {
  42. ACTION_BAR_KEY,
  43. stdin_default as default
  44. };