写出代码 适应刘海屏 <u-sticky bgColor=”#fff” v-if=”showSticky” :offset-top=”offTop”> <view class=”index-tab”> <u-tabs :list=”tabs” :current=”activeTabIndex” @click=”tabclick” lineWidth=”30″ lineHeight=”3″ lineColor=”#FDDE01″ :activeStyle=”{ color: ‘#303133’, fontWeight: ‘bold’, transform: ‘scale(1.05)’ }” :inactiveStyle=”{ color: ‘#606266′, }” :scrollable=”false”></u-tabs> </view> </u-sticky> //#ifdef MP-WEIXIN this.offTop = ’54px’; //#endif

export default {
  data() {
    return {
      offTop: '0px',
      // 其他数据...
    };
  },
  mounted() {
    const systemInfo = uni.getSystemInfoSync();
    if (systemInfo.model.indexOf('iPhone X') >= 0 || systemInfo.model.indexOf('华为') >= 0) {
      this.offTop = '44px'; // 假设刘海的高度为44px
    } else {
      this.offTop = '0px';
    }
  },
  // 其他方法...
};

By lxcss

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注