<el-carousel-item v-for="(item, index) in items" :key="item">
<img v-if="isImgItem(item)" class="item" :key="'item'+index" :src="item" width="100%" />
<video-player v-else class="video-player vjs-custom-skin"
:ref="'videoPlayer'+index"
:key="'item'+index"
:playsinline="true"
:options="playerOptions"
@ended="onPlayerEnded($event)"
>
</video-player>
<!-- <video v-else controls autoplay :key="index" class="item" type="video/mp4" :src="item" width="100%"></video> -->
</el-carousel-item>
this.playerOptions.sources[0].src = item;
let videoPlayer = eval("this.$refs.videoPlayer" +index)[0];
videoPlayer.player.play();
网友评论