bart
118
4
Vue

Wait for external resources

Posted 1 year ago by bart

Hey guys,

I want to build a Vue component that handles flowplayer videos. Sounds pretty simple and I'm sure it is, but I don't know how to solve the "DOM ready" stuff in Vue.

I currently have the following (example):

<template>
    <div id="video"></div>
</template>

<script>
    export default {
        mounted() {
            flowplayer('#video');
        }
    }
</script>

When I do this I'm getting something like flowplayer is not defined. How can I wait for the external JS script to be ready? I already tried this.$nextTick() {} but it didn't work, too. Maybe I can try window.onload = function () {}; but that does not feel right to me. What do you think? What's the best solution here?

Thanks and best regards.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.