import { defineComponent, Fragment, h, computed } from 'vue' import { useIsMobile, useIsTablet, useIsSmallDesktop } from './composables' export default defineComponent({ name: 'ComponentDemos', props: { span: { type: Number, default: 2 } }, setup (props) { const isMobileRef = useIsMobile() const isTabletRef = useIsTablet() const isSmallDesktop = useIsSmallDesktop() const mergedColsRef = computed(() => { return isMobileRef.value || isTabletRef.value || isSmallDesktop.value ? 1 : props.span }) return { mergedCols: mergedColsRef } }, render () { const children = this.$slots.default?.() ?? [] const { mergedCols } = this return (
{mergedCols === 1 ? ( children ) : ( <>
{children.filter((_, index) => index % 2 === 0)}
{children.filter((_, index) => index % 2 === 1)}
)}
) } })