ActionBar.mjs 1.2 KB

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