Skip to content

Commit

Permalink
Move fetchData() from template to methods
Browse files Browse the repository at this point in the history
(Templates are not made to call methods.)

Signed-off-by: Frederic Ruget <[email protected]>
  • Loading branch information
douzebis authored and beardhatcode committed May 25, 2021
1 parent d4c9014 commit 01fc82e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/components/Videos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
@canplay="doneLoading"
@loadedmetadata="onLoadedMetadata">

{{ fetchTracks() }}

<track v-for="track in tracks"
:key="track"
:src="track.src"
Expand Down Expand Up @@ -78,11 +76,11 @@ Vue.use(VuePlyr)
export default {
name: 'Videos',

data: () => ({
data() {
// This is required so that tracks is declared and reactive
// Otherwise updates may fail to make it to plyr
tracks: [],
}),
return { tracks: [], }
},

computed: {
livePhoto() {
Expand Down Expand Up @@ -137,6 +135,8 @@ export default {
},

onLoadedMetadata() {

this.fetchTracks()
this.updateVideoSize()
},

Expand Down

0 comments on commit 01fc82e

Please sign in to comment.