primevue-mirror/components/galleria/GalleriaItemSlot.vue

54 lines
1.2 KiB
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<script>
export default {
functional: true,
props: {
item: {
type: null,
default: null
},
index: {
type: Number,
default: 0
},
templates: {
type: null,
default: null
},
type: {
type: String,
default: null
}
},
render(createElement, context) {
const { item, index, templates, type } = context.props;
const template = templates && templates[type];
if (template) {
let content;
2022-09-14 11:26:01 +00:00
2022-09-06 12:03:37 +00:00
switch (type) {
case 'item':
case 'caption':
case 'thumbnail':
content = template({
item
});
break;
case 'indicator':
content = template({
index
});
break;
default:
content = template({});
break;
}
return content ? [content] : null;
}
return null;
}
2022-09-14 11:26:01 +00:00
};
2022-09-06 12:03:37 +00:00
</script>