chore: move mixins

This commit is contained in:
chenjiahan
2020-07-05 16:00:10 +08:00
parent 3a2e20eb52
commit 4a25ebf9ab
14 changed files with 844 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* Use scopedSlots in Vue 2.6+
* downgrade to slots in lower version
*/
export const SlotsMixin = {
methods: {
slots(name = 'default', props) {
const { $slots, $scopedSlots } = this;
const scopedSlot = $scopedSlots[name];
if (scopedSlot) {
return scopedSlot(props);
}
return $slots[name];
},
},
};