ActionBar.js 2.1 KB

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