Commit 03732111 authored by 杨奕's avatar 杨奕 Committed by cinwell.li

improve header background (#1416)

parent 84efedcc
...@@ -227,10 +227,13 @@ ...@@ -227,10 +227,13 @@
}; };
}, },
watch: { watch: {
'$route.path'() { '$route.path': {
immediate: true,
handler() {
this.isHome = /^home/.test(this.$route.name); this.isHome = /^home/.test(this.$route.name);
this.headerStyle.backgroundColor = `rgba(32, 160, 255, ${ this.isHome ? '0' : '1' })`; this.headerStyle.backgroundColor = `rgba(32, 160, 255, ${ this.isHome ? '0' : '1' })`;
} }
}
}, },
computed: { computed: {
lang() { lang() {
...@@ -248,7 +251,6 @@ ...@@ -248,7 +251,6 @@
} }
}, },
mounted() { mounted() {
this.isHome = this.$route.name === 'home';
function scroll(fn) { function scroll(fn) {
window.addEventListener('scroll', () => { window.addEventListener('scroll', () => {
fn(); fn();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment