|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
<template> |
|
|
|
|
<div :class="['header', { channel: isHome }]"> |
|
|
|
|
<div :class="['header', { channel: isHome, estate: isEstate }]"> |
|
|
|
|
<a class="logo" @click="toIndex"> |
|
|
|
|
<template v-if="!$store.getters.getModelType"> |
|
|
|
|
<img :src="require('@/assets/images/logo2.png')" alt=""> |
|
|
|
@ -11,7 +11,7 @@ |
|
|
|
|
</a> |
|
|
|
|
<!-- pc端 --> |
|
|
|
|
<template v-if="$store.getters.getModelType"> |
|
|
|
|
<navbar ref="nav" :isHome.sync="isHome"></navbar> |
|
|
|
|
<navbar ref="nav" :isHome.sync="isHome" :isEstate.sync="isEstate"></navbar> |
|
|
|
|
<div class="tools"> |
|
|
|
|
<img class="search" :src="require('@/assets/images/search' + (isHome ? '-white' : '') + '.png')" alt="" @click.stop="toggleSearch"> |
|
|
|
|
<img :src="require('@/assets/images/cn' + (isHome ? '-white' : '') + '.png')" alt="" @click.stop="toggleLang"> |
|
|
|
@ -42,12 +42,14 @@ |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import Util from '@/libs/util' |
|
|
|
|
import { mapMutations } from 'vuex' |
|
|
|
|
import navbar from '../navbar' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
isHome: this.$route.path === '/home' || this.$route.path === '/sfel', |
|
|
|
|
isHome: true, |
|
|
|
|
isEstate: false, |
|
|
|
|
showSearch: false, |
|
|
|
|
title: '', |
|
|
|
|
searchTimer: null, |
|
|
|
@ -63,9 +65,14 @@ export default { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
'$route'() { |
|
|
|
|
this.isHome = this.$route.path === '/home' || this.$route.path === '/sfel' |
|
|
|
|
'$route.path': { |
|
|
|
|
handler() { |
|
|
|
|
this.isHome = Util.isIndex() |
|
|
|
|
this.isEstate = this.$route.path === '/estate/index' |
|
|
|
|
}, |
|
|
|
|
deep: true, |
|
|
|
|
immediate: true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
beforeDestroy () { |
|
|
|
|
window.removeEventListener('scroll', this.handleScroll) |
|
|
|
@ -86,10 +93,11 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 获取页面滚动距离(home长页专用) |
|
|
|
|
handleScroll () { |
|
|
|
|
if (this.$route.path === '/home' || this.$route.path === '/sfel') { |
|
|
|
|
if (Util.isIndex()) { |
|
|
|
|
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop |
|
|
|
|
if (this.isHome == scrollTop > 907) { |
|
|
|
|
this.isHome = !(scrollTop > 907) |
|
|
|
|
this.isEstate = !(scrollTop > 907) && this.$route.path === '/estate/index' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -143,6 +151,9 @@ $height: 90px; |
|
|
|
|
background-color: #fff; |
|
|
|
|
border-bottom: 1px solid #f7f7f7; |
|
|
|
|
} |
|
|
|
|
&.estate { |
|
|
|
|
background-color: rgba(0, 0, 0, .15); |
|
|
|
|
} |
|
|
|
|
.logo{ |
|
|
|
|
position: absolute; |
|
|
|
|
top: 0; |
|
|
|
|