tserkov / vue-twitch-player

A Vue component for embedding a Twitch player.
MIT License
16 stars 4 forks source link

Emit child method #3

Open Ishodnikov opened 4 years ago

Ishodnikov commented 4 years ago

Hi! How to emit child method, for example, 'play' after listen method pause?

Parent:

<twitch-player :channel="url" @pause="onPaused()"></twitch-player>

    //...
    methods: {
        onPaused() {
            this.$emit('play'); //on child
        },
    //...
tserkov commented 4 years ago

Are you trying to make the player resume playing when it gets paused?

<twitch-player ref="player" :channel="url" @pause="onPause" />
{
    // ...
    methods: {
        onPaused() {
            this.$refs.player.play();
        },
    },
    // ...
}