1
I have the following component:
<div v-for="video in videos" :key="video.title">
<video class="video-js" controls preload="auto">
<source v-bind:src="video.src" type="video/mp4">
</video>
</div>
script:
<script>
export default {
data: () => ({
videos: [
{ title: "v1", src: "../../assets/videos/v1.mp4", desc: "v1"},
{ title: "v2", src: "../../assets/videos/v2.mp4", desc: "v2"}
]
})
}
</script>
But the vue.js
is not "converting" the video path.
When using <source src="../../assets/videos/v1.mp4" type="video/mp4">
in my html looks like this: <source src="/static/media/v1.dc6c1ef.mp4" type="video/mp4">
.
How can I have a array
link and do the bind
with the vue.js
correctly?
Perfect!! worked.. would have to import several videos using one
import
only?– MeuChapeu
I don’t know, I don’t think so. In a loop, I think you can use requires. Even import might work in a loop, I’ve never tried.
– bfavaretto