Summary.js 891 B

1234567891011121314151617181920212223242526
  1. import { computed, defineComponent, onBeforeUnmount, watchEffect } from 'vue';
  2. import { useInjectTable } from '../context/TableContext';
  3. var indexGuid = 0;
  4. var Summary = defineComponent({
  5. name: 'Summary',
  6. props: ['fixed'],
  7. setup: function setup(props, _ref) {
  8. var slots = _ref.slots;
  9. var tableContext = useInjectTable();
  10. var uniKey = "table-summary-uni-key-".concat(++indexGuid);
  11. var fixed = computed(function () {
  12. return props.fixed === '' || props.fixed;
  13. });
  14. watchEffect(function () {
  15. tableContext.summaryCollect(uniKey, fixed.value);
  16. });
  17. onBeforeUnmount(function () {
  18. tableContext.summaryCollect(uniKey, false);
  19. });
  20. return function () {
  21. var _slots$default;
  22. return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
  23. };
  24. }
  25. });
  26. export default Summary;