路径:/pages/annex/special/index.vue
复制:
<!-- 轮播搜索 -->
<homeComb v-if="showHomeComb" :dataConfig="homeCombData" @bindSortId="bindSortId" :isScrolled="isScrolled" :special='1'></homeComb>
<!-- 顶部搜索框 -->
<headerSerch v-if="isHeaderSerch" :dataConfig="headerSerchCombData" :special='1'></headerSerch>
<tabNav v-if="showCateNav" :dataConfig="cateNavData" @bindHeight="bindHeighta"
@bindSortId="bindSortId" :special='1' :isFixed="isFixed && !cateNavData.stickyConfig.tabVal"></tabNav>
复制:
<promotionList v-if="item.name == 'promotionList'" :dataConfig="item"
:productVideoStatus='product_video_status' :positionTop="positionTop">
</promotionList>
复制:
isFixed: false,
isHeaderSerch: false,
showHomeComb: false,
showCateNav: false,
homeCombData:{},
headerSerchCombData:{},
cateNavData:{},
domOffsetTop: 50,
positionTop: 0,
复制:
getMicroPage(id, type) {
let that = this;
that.styleConfig = []
uni.showLoading({
title: '加载中...'
});
getDiy(id).then(res => {
uni.hideLoading();
let data = res.data;
let diyArr = that.objToArr(res.data.value);
diyArr = diyArr.filter(item => !item.isHide);
diyArr.forEach((item,index) => {
if(['headerSerch','homeComb'].includes(item.name)){
diyArr.splice(index, 1);
}
});
this.styleConfig = diyArr;
}).catch(err => {
return that.$util.Tips({
title: err
});
uni.hideLoading();
});
},
复制:
setDiyData(data) {
if (data.length == 0) {
return this.$util.Tips({
title: '暂无数据'
}, {
tab: 3
})
}
if (data.is_bg_color) {
this.bgColor = data.color_picker
}
if (data.is_bg_pic) {
this.bgPic = data.bg_pic
this.bgTabVal = data.bg_tab_val
}
this.pageShow = data.is_show
uni.setNavigationBarTitle({
title: data.title
})
let temp = []
let lastArr = this.objToArr(data.value)
lastArr.forEach((item, index, arr) => {
if (item.name === 'homeComb' && !item.isHide) {
this.showHomeComb = true;
this.homeCombData = item;
if (item.searchConfig.tabVal) {
this.positionTop = 43
}
}
if (item.name == 'headerSerch' && !item.isHide) {
this.isHeaderSerch = true;
this.headerSerchCombData = item;
}
if (item.name == 'tabNav' && !item.isHide) {
this.showCateNav = true;
this.cateNavData = item;
}
if (!item.isHide) {
temp.push(item);
}
});
this.styleConfig = temp;
},
复制:
onPageScroll(e) {
if (this.isHeaderSerch) {
if (e.scrollTop > this.domOffsetTop) {
this.isFixed = true;
}
if (e.scrollTop < this.domOffsetTop) {
this.$nextTick(() => {
this.isFixed = false;
});
}
} else {
this.isFixed = false
}
if (e.scrollTop > 10) {
this.isScrolled = true;
} else {
this.isScrolled = false;
}
uni.$emit('scroll');
uni.$emit('onPageScroll', e.scrollTop);
},
链接:/pages/index/components/headerSerch.vue
复制:
<view class="mp-header" :class="special?'on':''" :style="[headerStyle, { paddingRight: (!special?serchRight:0) + 'px' }]">
<view class="sys-head" :style="{ height: statusBarHeight + 'px'}" v-if="!special"></view>
<view :style="'height:'+(statusBarHeight+serchHeight)+'px;'" v-if="!special"></view>
special: {
type: Number,
default: 0
}
复制:
&.on{
position: unset;
}
链接:/pages/index/components/homeComb.vue
复制:
v-if="!special"
:class="special?'on':''"
v-if="searchBox == 2 && dataConfig.logoConfig.url"
:style="[index===tabClick?classColor:'']"
复制:
&.on{
padding: 0 30rpx;
}
复制:
on: isFixed && special
special: {
type: Number,
default: 0
}
复制:
&.on{
top:0
}