dev #2
|
@ -25,14 +25,17 @@ const routes = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/:pathMatch(.*)',
|
path: '/:pathMatch(.*)',
|
||||||
|
name: '404',
|
||||||
component: notFoundPage
|
component: notFoundPage
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/videos',
|
path: '/videos',
|
||||||
|
name: 'video',
|
||||||
component: videoView
|
component: videoView
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/videos/:id',
|
path: '/videos/:id',
|
||||||
|
name: 'videos',
|
||||||
component: videosView
|
component: videosView
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
|
<template v-if="notFound">
|
||||||
|
<div class="notFound">
|
||||||
|
<h1>404 Page</h1>
|
||||||
|
<p>This page has not been found, <router-link to="/">click here</router-link> to return back home.</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
<h1>{{ video.videoName }}</h1>
|
<h1>{{ video.videoName }}</h1>
|
||||||
<video controls>
|
<video controls>
|
||||||
<source :src="require('@/assets/' + video.path)" type="video/mp4">
|
<source :src="require('@/assets/' + video.path)" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</template>
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import videoData from '../data/videos.js'
|
import videoData from '../data/videos.js'
|
||||||
|
@ -12,11 +21,13 @@
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
video: null,
|
video: null,
|
||||||
|
notFound: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
let videoID = this.$route.params.id;
|
let videoID = this.$route.params.id;
|
||||||
this.video = videoData.find(v => v.videoID === videoID);
|
this.video = videoData.find(v => v.videoID === videoID);
|
||||||
|
console.log(this.notFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue