improve header background (#1416)

pull/1426/head
杨奕 2016-11-28 16:56:03 +08:00 committed by cinwell.li
parent 84efedcc71
commit 0373211131
1 changed files with 6 additions and 4 deletions

View File

@ -227,9 +227,12 @@
};
},
watch: {
'$route.path'() {
this.isHome = /^home/.test(this.$route.name);
this.headerStyle.backgroundColor = `rgba(32, 160, 255, ${ this.isHome ? '0' : '1' })`;
'$route.path': {
immediate: true,
handler() {
this.isHome = /^home/.test(this.$route.name);
this.headerStyle.backgroundColor = `rgba(32, 160, 255, ${ this.isHome ? '0' : '1' })`;
}
}
},
computed: {
@ -248,7 +251,6 @@
}
},
mounted() {
this.isHome = this.$route.name === 'home';
function scroll(fn) {
window.addEventListener('scroll', () => {
fn();