[improvement] Use scoped-slots in Vue 2.6+ (#2688)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Use scopedSlots in Vue 2.6+
|
||||
* downgrade to slots in lower version
|
||||
*/
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
slots(name = 'default', props) {
|
||||
const { $slots, $scopedSlots } = this;
|
||||
if ($scopedSlots[name]) {
|
||||
return $scopedSlots[name](props);
|
||||
}
|
||||
return $slots[name];
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user