【问题标题】:Displaying a video in Laravel View在 Laravel View 中显示视频
【发布时间】:2021-07-16 14:40:29
【问题描述】:

我在使用 Laravel 作为后端并使用 Vue Js 作为前端在视图中显示视频时遇到问题。 这是我的代码。 我可以使用{{product.video[0].filename}} 显示数据库中的文件名,但无法在此行中翻译它 src="'video2/...

这是代码

 {{product.video[0].filename}} //Here am able to display filename correctly from database

<video width="320" height="240" controls>
  <source src="'video2/'+product.video[0].filename type="video/mp4">// This cant capture the 
                                                                           video from video folder.
</video>

但是如果我写 &lt;source src="test.mp4" type="video/mp4"&gt; 这可以正常工作,但我想使用数据库中的确切名称进行捕获。

【问题讨论】:

    标签: laravel vue.js


    【解决方案1】:

    你需要像这样:src绑定视频src

    <video width="320" height="240" controls>
        <source :src="'video2/'+product.video[0].filename" type="video/mp4">
        video from video folder.
    </video>
    

    参考链接

    https://vuejs.org/v2/guide/syntax.html#Attributes

    How to bind to attribute in Vue JS?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-29
      • 2020-05-02
      • 1970-01-01
      相关资源
      最近更新 更多