Summary.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _vue = require("vue");
  7. var _TableContext = require("../context/TableContext");
  8. var indexGuid = 0;
  9. var Summary = (0, _vue.defineComponent)({
  10. name: 'Summary',
  11. props: ['fixed'],
  12. setup: function setup(props, _ref) {
  13. var slots = _ref.slots;
  14. var tableContext = (0, _TableContext.useInjectTable)();
  15. var uniKey = "table-summary-uni-key-".concat(++indexGuid);
  16. var fixed = (0, _vue.computed)(function () {
  17. return props.fixed === '' || props.fixed;
  18. });
  19. (0, _vue.watchEffect)(function () {
  20. tableContext.summaryCollect(uniKey, fixed.value);
  21. });
  22. (0, _vue.onBeforeUnmount)(function () {
  23. tableContext.summaryCollect(uniKey, false);
  24. });
  25. return function () {
  26. var _slots$default;
  27. return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
  28. };
  29. }
  30. });
  31. var _default = Summary;
  32. exports.default = _default;