feat:173版本
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view class="content-two">
|
||||
<view class="top-header-container">
|
||||
<TopSafe></TopSafe>
|
||||
<view class="head-view">
|
||||
<view class="head-search" @click="onJumpSearch">
|
||||
<TopSafe v-if="!isMP"></TopSafe>
|
||||
<view class="head-view" :style="mpHeaderStyle">
|
||||
<view class="head-search" :style="mpSearchStyle" @click="onJumpSearch">
|
||||
<u-icon size="24" name="search" color="#999"></u-icon>
|
||||
<text class="text-28 text-fu" style="margin-left: 12rpx">搜索</text>
|
||||
</view>
|
||||
@@ -82,8 +82,8 @@ export default {
|
||||
// #endif
|
||||
},
|
||||
mescrollTop() {
|
||||
// #ifdef MP-WEIXIN
|
||||
return '400rpx';
|
||||
// #ifdef MP-WEIXIN || MP
|
||||
return this.mpMescrollTop || '360rpx';
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
return '260rpx';
|
||||
@@ -104,6 +104,10 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isMP: false,
|
||||
mpHeaderStyle: {},
|
||||
mpSearchStyle: {},
|
||||
mpMescrollTop: '',
|
||||
itemType: 1, // 1: 图2样式, 2: 图1样式
|
||||
dataList: [],
|
||||
tabArr: [
|
||||
@@ -157,6 +161,10 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
// #ifdef MP-WEIXIN || MP
|
||||
this.isMP = true;
|
||||
this.initMPHeader();
|
||||
// #endif
|
||||
console.log("+++++", options)
|
||||
if (options.index) {
|
||||
this.curTab = options.index;
|
||||
@@ -185,6 +193,44 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initMPHeader() {
|
||||
// #ifdef MP-WEIXIN || MP
|
||||
try {
|
||||
const menuButton = uni.getMenuButtonBoundingClientRect();
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (menuButton && menuButton.top && menuButton.top > 0) {
|
||||
const menuButtonHeight = menuButton.height || 32;
|
||||
const menuButtonTop = menuButton.top;
|
||||
const menuButtonLeft = menuButton.left;
|
||||
const windowWidth = systemInfo.windowWidth;
|
||||
|
||||
const rightPadding = windowWidth - menuButtonLeft + 12;
|
||||
|
||||
this.mpHeaderStyle = {
|
||||
paddingTop: `${menuButtonTop}px`,
|
||||
paddingRight: `${rightPadding}px`,
|
||||
paddingLeft: '16px',
|
||||
paddingBottom: '8px',
|
||||
height: `${menuButtonTop + menuButtonHeight + 8}px`,
|
||||
boxSizing: 'border-box',
|
||||
display: 'flex',
|
||||
alignItems: 'center'
|
||||
};
|
||||
|
||||
this.mpSearchStyle = {
|
||||
height: `${menuButtonHeight}px`,
|
||||
borderRadius: `${menuButtonHeight / 2}px`,
|
||||
boxSizing: 'border-box'
|
||||
};
|
||||
|
||||
const totalHeaderPx = menuButtonTop + menuButtonHeight + 8 + 80;
|
||||
this.mpMescrollTop = `${totalHeaderPx}px`;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("initMPHeader error:", e);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
getTabColor(item) {
|
||||
if (!item) return '#7A35F6';
|
||||
if (item.color) return item.color;
|
||||
@@ -317,10 +363,6 @@ export default {
|
||||
width: 100%;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
padding-top: 40rpx;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.head-view {
|
||||
|
||||
Reference in New Issue
Block a user