Skip to content

SSR and dynamic javascript package loading #513

Closed Answered by victorkarnbach
victorkarnbach asked this question in Q&A
Discussion options

You must be logged in to vote

Solved it via:

 <div v-if="isClient" class="splide1">
        <component :is="splideComponent" :options="options"
        >
            <component :is="splideSlideComponent">
               Slide content..
            </component>
            <component :is="splideSlideComponent">
               Slide content..
            </component>
    </div>
</template>

<script setup>
import {onMounted, ref, shallowRef} from "vue";

const isClient = ref(false);

const splideComponent = shallowRef(null);
const splideSlideComponent = shallowRef(null);

onMounted(async () => {
    if (typeof window !== 'undefined') {
        const { Splide, SplideSlide } = await import('@splidejs/vue-splide'); // impor…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by victorkarnbach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant