Authored by 李奇

fixed: ios顶部电池栏占用视口高度影响fixed定位

... ... @@ -67,7 +67,7 @@ module.exports = {
rootValue: 40,
unitPrecision: 5, // 保留5位小数字
minPixelValue: 2, // 小于 2 时,不转换
selectorBlackList: [], // 选择器黑名单,可以使用正则
selectorBlackList: ['.fix-ios-top'], // 选择器黑名单,可以使用正则
propWhiteList: [] // 属性名称为空,表示替换所有属性的值
},
'postcss-use': {
... ...
<template>
<div class="cate-res">
<div class="cate-res" :class="{'fix-ios-top': needFix}">
<brand-search></brand-search>
<tab :page="page"></tab>
<tab :page="page" :fix-ios-top="true"></tab>
<resources :content-code="contentCode"></resources>
</div>
</template>
... ... @@ -19,12 +19,17 @@
}
}
}
.fix-ios-top {
margin-top: 20px;
}
</style>
<script>
import contentCode from 'content-code';
import qs from 'yoho-qs';
import cookie from 'yoho-cookie';
import yoho from 'yoho';
import tab from 'channel/tab.vue';
import resources from 'component/resources/index.vue';
import brandSearch from 'channel/brand-search.vue';
... ... @@ -36,13 +41,19 @@
data() {
return {
page: 'cate',
contentCode: contentCode.cate[detaultChannel]
contentCode: contentCode.cate[detaultChannel],
needFix: false
};
},
components: {
tab,
resources,
brandSearch
},
created() {
if (yoho.isiOS) {
this.needFix = true;
}
}
};
</script>
... ...
<template>
<div v-if="channel.length" class="channel-tab">
<div v-if="channel.length" class="channel-tab" :class="{'fix-ios-top': fixIosTop}">
<div class="channel ellipsis" v-for="(item, index) in channel" :key="index" :class="{focus: index === currentChannel}"
@click="changeChannel(index, item.id)" :style="{width: (1 / channel.length) * 100 + '%'}">
<span class="name">{{item.name && item.name.toUpperCase()}}</span>
... ... @@ -36,6 +36,10 @@
type: String,
default: 'channel'
},
fixIosTop: {
type: Boolean,
default: false
}
},
data() {
return {
... ... @@ -107,6 +111,10 @@
border-bottom: 1px solid #f6f6f6;
font-family: "BrownStd", "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial;
&.fix-ios-top {
margin-top: 20px;
}
.channel {
display: inline-block;
line-height: 80px;
... ...
<template>
<div class="top-filter clearfix" :class="{'search-page': searchPage}">
<div class="top-filter clearfix" :class="{'search-page': searchPage, 'fix-ios-top': fixIosTop}">
<div class="filter-overlay" v-show="layFlag" @click="close"></div>
<div class="filter-content">
<ul class="filter-type">
... ... @@ -63,6 +63,10 @@ export default {
searchPage: {
type: Boolean,
default: false
},
fixIosTop: {
type: Boolean,
default: false
}
},
data(){
... ... @@ -325,6 +329,14 @@ export default {
z-index: 220;
border-top: 1px solid #eee;
&.fix-ios-top {
margin-top: 15px;
.filter-overlay {
top: 135px!important;
}
}
&.search-page {
top: 0;
}
... ...
... ... @@ -4,7 +4,8 @@
<div :class='{"shop-goods-top": true}' class="list-items">
<goods-list :data="productList" :state="listState"></goods-list>
</div>
<filter-box :val="order" :filter="filterConfig" v-if="enableOrder" ref="filter"></filter-box>
<filter-box :val="order" :filter="filterConfig" v-if="enableOrder" ref="filter"
:fix-ios-top="fixIosTop"></filter-box>
</div>
</template>
<style>
... ... @@ -20,6 +21,7 @@
</style>
<script>
import $ from 'jquery';
import yoho from 'yoho';
import qs from 'yoho-qs/parse';
import bus from 'common/vue-bus';
import tip from 'common/tip';
... ... @@ -55,7 +57,8 @@
productList: [],
inSearching: false,
enableOrder: false,
order: ''
order: '',
fixIosTop: false
};
},
computed: {
... ... @@ -209,6 +212,10 @@
self.filter = val;
self.$refs.filter.isVisible = false;
});
if(yoho.isiOS) {
this.fixIosTop = true;
}
}
};
... ...