WeChat アプレットのカスタム ナビゲーション ツールバーにホーム ボタンを追加する

1、先声明

2. wxml を書く

<view class="box">
    <!-- ステータスバーの高さ -->
    <view style="高さ: {
  
  {statusBarHeight}}px"></view>
    <!-- タイトル バーの高さ -->
    <view class='nav' style="height: {
  
  {toBarHeight}}px;" bindtap="backClick">
<!-- <image src="/image/tab/icon_item_1.png"></image>-->
        <view class="img-back"><van-icon name="arrow-left" size="22" /></view>
        <text class="title-custom" style="height: {
  
  {toBarHeight}}px;line-height: {
   
  {toBarHeight}}px">{
   
  {cusTitle}}
        </テキスト>
    </view>
</view>

3.ステータスバーの高さを設定する

statusBarHeight: 44, //ステータスバーの初期の高さ
toBarHeight: 44, //タイトル バーの高さ: Android: 48px, iOS: 44px; 単位は px を使用するカプセル ボタンと同じでなければなりません
// 電話のステータスバーの高さ
let sysinfo = wx.getSystemInfoSync();
this.setData({
    statusBarHeight: sysinfo.statusBarHeight
}))

おすすめ

転載: blog.csdn.net/qq_34907249/article/details/127898150