ActionBar.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. ACTION_BAR_KEY: () => ACTION_BAR_KEY,
  21. actionBarProps: () => actionBarProps,
  22. default: () => stdin_default
  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. var import_use_placeholder = require("../composables/use-placeholder");
  30. const [name, bem] = (0, import_utils.createNamespace)("action-bar");
  31. const ACTION_BAR_KEY = Symbol(name);
  32. const actionBarProps = {
  33. placeholder: Boolean,
  34. safeAreaInsetBottom: import_utils.truthProp
  35. };
  36. var stdin_default = (0, import_vue2.defineComponent)({
  37. name,
  38. props: actionBarProps,
  39. setup(props, {
  40. slots
  41. }) {
  42. const root = (0, import_vue2.ref)();
  43. const renderPlaceholder = (0, import_use_placeholder.usePlaceholder)(root, bem);
  44. const {
  45. linkChildren
  46. } = (0, import_use.useChildren)(ACTION_BAR_KEY);
  47. linkChildren();
  48. const renderActionBar = () => {
  49. var _a;
  50. return (0, import_vue.createVNode)("div", {
  51. "ref": root,
  52. "class": [bem(), {
  53. "van-safe-area-bottom": props.safeAreaInsetBottom
  54. }]
  55. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  56. };
  57. return () => {
  58. if (props.placeholder) {
  59. return renderPlaceholder(renderActionBar);
  60. }
  61. return renderActionBar();
  62. };
  63. }
  64. });