1π
β
This is not the Vue way to work with DOM, you could use slots
:
export default {
name: 'carousel',
setup(props, { slots }) {
const wrapperRef = ref(null);
let noOfSlides = ref(0);
onMounted(function () {
console.log('slots ', slots.default());
noOfSlides.value = slots.default().length;
});
function log(n) {
console.log('n ', n);
}
return {
wrapperRef,
noOfSlides,
log,
};
},
};
Source:stackexchange.com