23 lines
		
	
	
		
			448 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			448 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Use scopedSlots in Vue 2.6+
 | |
|  * downgrade to slots in lower version
 | |
|  */
 | |
| export var SlotsMixin = {
 | |
|   methods: {
 | |
|     slots: function slots(name, props) {
 | |
|       if (name === void 0) {
 | |
|         name = 'default';
 | |
|       }
 | |
| 
 | |
|       var $slots = this.$slots,
 | |
|           $scopedSlots = this.$scopedSlots;
 | |
|       var scopedSlot = $scopedSlots[name];
 | |
| 
 | |
|       if (scopedSlot) {
 | |
|         return scopedSlot(props);
 | |
|       }
 | |
| 
 | |
|       return $slots[name];
 | |
|     }
 | |
|   }
 | |
| }; | 
