Skip to content

Commit

Permalink
update readme: 更新title变换
Browse files Browse the repository at this point in the history
  • Loading branch information
muwoo committed Aug 4, 2017
1 parent 60e4cfe commit 76b9080
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
17 changes: 15 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,21 @@ app.get('*', (req, res) => {
console.error(err)
}
}

renderer.renderToStream({ url: req.url })
var title = ''
switch (req.url) {
case '/moving':
title = '正在热映'
break;
case '/upcoming':
title = '即将上映'
break;
case '/top250':
title = 'Top250'
break;
default:
title = '404'
}
renderer.renderToStream({ title, url: req.url })
.on('error', errorHandler)
.on('end', () => console.log(`whole request: ${Date.now() - s}ms`))
.pipe(res)
Expand Down
2 changes: 1 addition & 1 deletion src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>doubanMovie</title>
<title>{{title}}</title>
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<link rel="shortcut icon" sizes="48x48" href="/public/logo-48.png">
Expand Down
2 changes: 1 addition & 1 deletion src/views/moving.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
},
mounted () {
console.log(this.$store.state.moving)
document.title = '正在热映'
this.$store.dispatch('getMoving')
},
methods: {
Expand Down
1 change: 1 addition & 0 deletions src/views/top250.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
}
},
mounted () {
document.title = 'top250'
this.$store.commit('PAGE_START', {start: 8})
this.$store.dispatch('loadingtop250')
},
Expand Down
1 change: 1 addition & 0 deletions src/views/upcoming.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
/**
* 获取即将上映列表
*/
document.title = '即将上映'
this.$store.dispatch('getUpcoming')
},
methods: {
Expand Down

0 comments on commit 76b9080

Please sign in to comment.