[improvement] mixins typescript (#3690)

This commit is contained in:
neverland
2019-06-29 11:31:53 +08:00
committed by GitHub
parent 0a79536a05
commit abe3e59bed
17 changed files with 135 additions and 82 deletions
-16
View File
@@ -1,16 +0,0 @@
/**
* Use scopedSlots in Vue 2.6+
* downgrade to slots in lower version
*/
export const SlotsMixin = {
methods: {
slots(name = 'default', props) {
const { $slots, $scopedSlots } = this;
if ($scopedSlots[name]) {
return $scopedSlots[name](props);
}
return $slots[name];
}
}
};