slots.js 448 B

1234567891011121314151617181920212223
  1. /**
  2. * Use scopedSlots in Vue 2.6+
  3. * downgrade to slots in lower version
  4. */
  5. export var SlotsMixin = {
  6. methods: {
  7. slots: function slots(name, props) {
  8. if (name === void 0) {
  9. name = 'default';
  10. }
  11. var $slots = this.$slots,
  12. $scopedSlots = this.$scopedSlots;
  13. var scopedSlot = $scopedSlots[name];
  14. if (scopedSlot) {
  15. return scopedSlot(props);
  16. }
  17. return $slots[name];
  18. }
  19. }
  20. };