mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
19 lines
356 B
JavaScript
19 lines
356 B
JavaScript
/**
|
|
* 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];
|
|
},
|
|
},
|
|
};
|