Add route to Post view

master
Raymonzut 5 years ago
parent f89c9251e6
commit abcc91ca81
No known key found for this signature in database
GPG Key ID: 97CF2D8BE2C69FC7
  1. 7
      client/src/router/index.js
  2. 3
      client/src/views/Posts.vue

@ -2,6 +2,7 @@ import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import Home from '../views/Home.vue' import Home from '../views/Home.vue'
import Posts from '../views/Posts.vue' import Posts from '../views/Posts.vue'
import Post from '../views/Post.vue'
import QAPage from '../views/QAPage' import QAPage from '../views/QAPage'
Vue.use(VueRouter) Vue.use(VueRouter)
@ -17,6 +18,12 @@ const routes = [
name: "Posts", name: "Posts",
component: Posts, component: Posts,
}, },
{
path: "/posts/:id",
name: "Post",
component: Post,
props: true,
},
{ {
path: "/qa", path: "/qa",
name: "QA", name: "QA",

@ -5,7 +5,8 @@
<div> <div>
<ul> <ul>
<li v-for="(postItem, j) in getPostItems(month)" :key="j"> <li v-for="(postItem, j) in getPostItems(month)" :key="j">
{{ getPostItemDate(postItem) }} {{ postItem.title }} {{ getPostItemDate(postItem) }}
<a :href="/posts/ + postItem._id">{{ postItem.title }}</a>
</li> </li>
</ul> </ul>
</div> </div>

Loading…
Cancel
Save