Skip to content

Commit 97b2202

Browse files
author
Shaun Pelling
committed
added code
1 parent e53d0ec commit 97b2202

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
},
1111
"dependencies": {
1212
"vue": "^2.2.1",
13-
"vue-resource": "^1.2.1"
13+
"vue-resource": "^1.2.1",
14+
"vue-router": "^2.3.1"
1415
},
1516
"devDependencies": {
1617
"babel-core": "^6.0.0",

src/App.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<div>
3-
<show-blogs></show-blogs>
4-
<list-blogs></list-blogs>
3+
<router-view></router-view>
54
</div>
65
</template>
76

src/components/addBlog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default {
7272
}
7373
</script>
7474

75-
<style>
75+
<style scoped>
7676
#add-blog *{
7777
box-sizing: border-box;
7878
}

src/main.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import Vue from 'vue'
22
import VueResource from 'vue-resource'
3+
import VueRouter from 'vue-router'
34
import App from './App.vue'
5+
import Routes from './routes'
46

5-
// Use vue-resource package
7+
// Use packages
68
Vue.use(VueResource);
9+
Vue.use(VueRouter);
10+
11+
// Register routes
12+
const router = new VueRouter({
13+
routes: Routes
14+
});
715

816
new Vue({
917
el: '#app',
10-
render: h => h(App)
18+
render: h => h(App),
19+
router: router
1120
})

src/routes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import addBlog from './components/addBlog.vue';
2+
import showBlogs from './components/showBlogs.vue';
3+
4+
export default [
5+
{ path: '/', component: showBlogs},
6+
{ path: '/add', component: addBlog}
7+
]

0 commit comments

Comments
 (0)