Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e5c6d7

Browse files
committed
✨ setup routes and add navbar
1 parent 4b7836f commit 0e5c6d7

File tree

9 files changed

+121
-5
lines changed

9 files changed

+121
-5
lines changed

‎hacker-news-clone/src/App.vue‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
11
<template>
22
<div id="app">
3-
<router-view/>
3+
<div class="content">
4+
<Navbar></Navbar>
5+
<router-view/>
6+
</div>
47
</div>
58
</template>
69

10+
<script>
11+
import Navbar from './components/Navbar';
12+
13+
export default {
14+
name: 'App',
15+
components: {
16+
Navbar
17+
}
18+
}
19+
</script>
20+
21+
722
<style>
23+
body {
24+
font-family: Verdana, Geneva, sans-serif;
25+
font-size: 10pt;
26+
color: #828282;
27+
}
28+
29+
a {
30+
color: #000;
31+
text-decoration: none;
32+
}
33+
34+
.content {
35+
width: 85%;
36+
background-color: rgb(246, 246, 239);
37+
margin: auto;
38+
}
839
</style>
100 Bytes
Loading[フレーム]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div id="navbar">
3+
<img src="../assets/logo.gif" id="logo">
4+
<span>
5+
<router-link to="/">Hacker News</router-link>
6+
</span>
7+
<ul id="menu">
8+
<li class="item"><router-link to="/new">new</router-link></li>
9+
<li class="item"><router-link to="/ask">ask</router-link></li>
10+
<li class="item"><router-link to="/show">show</router-link></li>
11+
<li class="item"><router-link to="/jobs ">jobs</router-link></li>
12+
</ul>
13+
</div>
14+
</template>
15+
16+
<script>
17+
export default {
18+
name: 'Navbar',
19+
};
20+
</script>
21+
22+
23+
<style>
24+
#navbar {
25+
display: flex;
26+
background-color: rgb(255, 102, 0);
27+
font-size: 10pt;
28+
color: #828282;
29+
padding: 3px;
30+
height: 20px;
31+
}
32+
33+
#navbar #logo {
34+
border: 1px solid #fff;
35+
margin-right: 5px;
36+
}
37+
38+
#navbar span {
39+
font-weight: bold;
40+
}
41+
42+
#navbar ul#menu {
43+
margin: 0;
44+
padding-left: 10px;
45+
}
46+
47+
#navbar ul#menu li.item {
48+
display: inline-block;
49+
margin-right: 10px;
50+
padding-right: 10px;
51+
border-right: 1px solid #000;
52+
}
53+
54+
#navbar ul#menu li.item a.router-link-exact-active.router-link-active {
55+
color: #fff;
56+
}
57+
58+
</style>

‎hacker-news-clone/src/router.js‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
11
import Vue from 'vue';
22
import Router from 'vue-router';
3-
import Home from './views/Home.vue';
3+
import News from './views/News.vue';
4+
import Newest from './views/Newest.vue';
5+
import Ask from './views/Ask.vue';
6+
import Show from './views/Show.vue';
7+
import Jobs from './views/Jobs.vue';
8+
49

510
Vue.use(Router);
611

712
export default new Router({
813
routes: [
914
{
1015
path: '/',
11-
name: 'home',
12-
component: Home,
16+
name: 'news',
17+
component: News,
18+
},
19+
{
20+
path: '/new',
21+
name: 'new',
22+
component: Newest,
23+
},
24+
{
25+
path: '/ask',
26+
name: 'ask',
27+
component: Ask,
28+
},
29+
{
30+
path: '/show',
31+
name: 'show',
32+
component: Show,
33+
},
34+
{
35+
path: '/jobs',
36+
name: 'jobs',
37+
component: Jobs,
1338
},
1439
],
1540
});

‎hacker-news-clone/src/views/Ask.vue‎

Whitespace-only changes.

‎hacker-news-clone/src/views/Jobs.vue‎

Whitespace-only changes.

‎hacker-news-clone/src/views/Newest.vue‎

Whitespace-only changes.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<template>
22
<div>
3+
test
34
</div>
45
</template>
56

67
<script>
7-
88
export default {
9+
name: 'News',
10+
911
};
1012
</script>

‎hacker-news-clone/src/views/Show.vue‎

Whitespace-only changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /