Article From:

Video pop-up, if placed on the outer layer, it can be called normally.

But if you add a layer of el-dialog, you won’t get the ID, and there is something in the $ref output from the callback function.

But this.$ref.myPlayer1 returns to undefined.

<el-dialog title=”Video “v-model=” playFormVisible “: close-on-click-modal=” false “@open=’show ()’&gt”;

        <video id="myPlayer1" poster="" controls playsInline webkit-playsinline autoplay ref="myPlayer1">
            <source src="rtmp://" type="rtmp/flv" />
            <source src="" type="application/x-mpegURL" />

If you want this to be normal, how should you write it, or how do you get it?

Answer 0:

video It’s actually installed inel-dialog Aslot When the page comes in,dialog Not yet, of It’s the element.

belongdialog After mountingvideo Elements.

show () {
   this.playFormVisible = true
   this.$nextTick(() => console.log(this.$refs.myPlayer1))


aboutnextTick,You can look at the document:

Answer 1:

v-modelWhat a ghost, change it into:visible.syncAccording to the official website,
And then inmountedInside$refTry

Leave a Reply

Your email address will not be published. Required fields are marked *