javascript - vue 2.0 video tag, the url is obtained through ajax, and the video linked using v-bind:src="" cannot be played
迷茫
迷茫 2017-06-12 09:31:32
0
2
1297

vue 2.0 video tag, use v-bind:src="" to link the video url, and the url isobtained from ajax in the database after the page is loaded. The page is successfully rendered, but the video cannot Play.

network did not link to load this video.

The page is successfully rendered. If you directly put the following code into an ordinary html file, it can be played successfully.

source code:

The project was written in vue 1.0 before. It was recently upgraded to vue 2.0 due to reconstruction. Before, vue 2.0 used {{}} to bind. Vue 2.0 has removed this binding method and can only use: src. Please ask God to answer this question.

The reason for my personal test is that the url cannot be played normally because ajax returns it. After setting the attribute value of the commentVideo object in data, it can be played, but if ajax obtains the data and then assigns it, it cannot be played.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all (2)
習慣沉默

Okay, friend, take a look, the network speed is a bit slow, I’d better give you a screenshot
Of course, it’s also possible that you didn’t trigger the change of the vue view after getting the url.

This is the supplementary code, the same reason

    Document  

    阿神

    Maybe your initialization code is in ready, vue2’s ready is called mounted

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!