Tag:element-uivue.js
Article From:https://segmentfault.com/q/1010000012146949
Question:

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://rtmp.open.ys7.com/openlive/f01018a141094b7fa138b9d0b856507b" type="rtmp/flv" />
            <source src="http://hls.open.ys7.com/openlive/f01018a141094b7fa138b9d0b856507b.m3u8" type="application/x-mpegURL" />
        </video>
    </el-dialog>

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 course.video 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: https://cn.vuejs.org/v2/api/#Vue-nextTick

Answer 1:

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

Similar Posts:

Leave a Reply

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