国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當前位置: 首頁 > news >正文

如何做外賣網站app東莞百度搜索網站排名

如何做外賣網站app,東莞百度搜索網站排名,注冊公司的流程和要求,企業(yè)密信app下載安裝在頁面中實現(xiàn)自定義頭部導航的組件,如果僅是單個頁面中需要自定義可在頁面的json文件中配置"navigationStyle": “custom”,如果是項目中所有頁面都想使用自定義的組件,可在app.json的window中全局配置"navigationStyle"…

在頁面中實現(xiàn)自定義頭部導航的組件,如果僅是單個頁面中需要自定義可在頁面的json文件中配置"navigationStyle": “custom”,如果是項目中所有頁面都想使用自定義的組件,可在app.json的window中全局配置"navigationStyle": “custom”。
先分析頭部導航的組成,可參考圖1
圖1
其組成主要包含兩部分:狀態(tài)欄、導航區(qū)域,下面分別說說這兩部分的高度如何獲取。
1、獲取狀態(tài)欄高度
對于不同的機型而言,狀態(tài)欄的高度是有所差異的,可通過wx.getSystemInfo來獲取,但需要注意的是該接口在基礎庫2.20.1后就停止維護,需要改用wx.getWindowInfo獲取。
(1)使用wx.getSystemInfo獲取示例代碼

wx.getSystemInfo({success: (res) => {this.setData({statusBarHeight: res.statusBarHeight })}
})

在這里插入圖片描述
(2)使用wx.getWindowInfo示例代碼

 constres = wx.getWindowInfo()this.setData({statusBarHeight: res.statusBarHeight })

2、導航區(qū)域高度
(1)導航區(qū)域的高度可自己定義,但考慮到右側膠囊,為使得標題位置垂直居中,因而導航區(qū)域的高度實際也需要計算得出。其公式為:導航區(qū)域的高度 = 膠囊的高度 + 膠囊距離狀態(tài)欄的高度 * 2。

// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標信息以屏幕左上角為原點。
const rect = wx.getMenuButtonBoundingClientRect()
console.log('右上角膠囊按鈕)布局', rect);

在這里插入圖片描述

// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標信息以屏幕左上角為原點。
const rect = wx.getMenuButtonBoundingClientRect()
console.log('右上角膠囊按鈕)布局', rect);
wx.getSystemInfo({success: (res) => {this.setData({navBarHeight: rect.bottom - rect.top + (rect.top - res.statusBarHeight) * 2, // navBarHeight: rect.height + (rect.top - res.statusBarHeight) * 2, })}
})

(2)考慮到膠囊位置,因而導航欄區(qū)域可自定義的寬度需減去膠囊的寬度,使用padding-right的方式占用膠囊的寬,注意需要設置為box-sizing: border-box,懂得都懂。
在這里插入圖片描述

// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標信息以屏幕左上角為原點。const rect = wx.getMenuButtonBoundingClientRect()console.log('右上角膠囊按鈕)布局', rect);wx.getSystemInfo({success: (res) => {this.setData({innerPaddingRight: `padding-right:${res.windowWidth - rect.left}px`,})}})

(3)剩余的寬度你就可以自由發(fā)揮了。
以下是組件參考代碼
index.xml

<view class="weui-navigation-bar {{extClass}}"><view class="status-bar" style="height: {{statusBarHeight}}px; color: {{color}}; background: {{background}}"></view><view class="weui-navigation-bar__inner" style="height: {{navBarHeight}}px; color: {{color}}; background: {{background}}; {{displayStyle}}; {{innerPaddingRight}}"><view class='weui-navigation-bar__left' style="{{leftWidth}}"><block wx:if="{{back}}"><view class="navigation-bar__buttons" bindtap="back"><view class="navigation-bar__button navigation-bar__btn_goback" hover-class="active"></view></view></block><block wx:else><slot name="left"></slot></block></view><view class='weui-navigation-bar__center'><view wx:if="{{loading}}" class="weui-navigation-bar__loading" aria-role="alert"><view class="weui-loading" style="width:{{size.width}}rpx;height:{{size.height}}rpx;" aria-role="img" aria-label="加載中"></view></view><block wx:if="{{title}}"><text>{{title}}</text></block><block wx:else><slot name="center"></slot></block></view><view class='weui-navigation-bar__right'><slot name="right"></slot></view></view>
</view>

index.wxss

.weui-navigation-bar {overflow: hidden;color: rgba(0, 0, 0, .9);width: 100vw;
}
.status-bar{width: 100%;
}
.weui-navigation-bar__placeholder {background: #f7f7f7;position: relative;
}
.weui-navigation-bar__inner, .weui-navigation-bar__inner .weui-navigation-bar__left {display: flex;align-items: center;flex-direction: row;
}
.weui-navigation-bar__inner {position: relative;padding-right: 95px;width: 100vw;box-sizing: border-box;padding-top: env(safe-area-inset-top);
}
.weui-navigation-bar__inner .weui-navigation-bar__left {position: relative;width: 95px;padding-left: 16px;box-sizing: border-box;
}
.weui-navigation-bar__btn_goback_wrapper {padding: 11px 18px 11px 16px;margin: -11px -18px -11px -16px;
}
.weui-navigation-bar__inner .weui-navigation-bar__left .navigation-bar__btn_goback {font-size: 12px;width: 12px;height: 24px;background: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%;background-size: cover;
}
.weui-navigation-bar__inner .weui-navigation-bar__center {font-size: 17px;text-align: center;position: relative;flex: 1;display: flex;flex-direction: column;align-items: center;justify-content: center;font-weight: bold;
}
@media(prefers-color-scheme: dark) {.weui-navigation-bar {color: hsla(0, 0%, 100%, .8);}.weui-navigation-bar__inner {background-color: #1f1f1f;}
}

index.js

Component({options: {multipleSlots: true // 在組件定義時的選項中啟用多slot支持},/*** 組件的屬性列表*/properties: {extClass: {type: String,value: ''},title: {type: String,value: ''},background: {type: String,value: '#fff'},color: {type: String,value: '#000'},back: {type: Boolean,value: true},loading: {type: Boolean,value: false},animated: {// 顯示隱藏的時候opacity動畫效果type: Boolean,value: true},show: {// 顯示隱藏導航,隱藏的時候navigation-bar的高度占位還在type: Boolean,value: true,observer: '_showChange'},// back為true的時候,返回的頁面深度delta: {type: Number,value: 1}},/*** 組件的初始數(shù)據*/data: {displayStyle: '',statusBarHeight: 20},attached() {// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標信息以屏幕左上角為原點。const rect = wx.getMenuButtonBoundingClientRect()// console.log('右上角膠囊按鈕)布局', rect);wx.getSystemInfo({success: (res) => {this.setData({innerPaddingRight: `padding-right:${res.windowWidth - rect.left}px`,leftWidth: `width:${res.windowWidth - rect.left}px`,// navBarHeight: rect.bottom + rect.top  - res.statusBarHeight,  //84pxnavBarHeight: rect.bottom - rect.top + (rect.top - res.statusBarHeight) * 2, //40pxstatusBarHeight: res.statusBarHeight //44px})}})},/*** 組件的方法列表*/methods: {_showChange(show) {const animated = this.data.animatedlet displayStyle = ''if (animated) {displayStyle = `opacity: ${show ? '1' : '0'};transition: opacity 0.5s;`} else {displayStyle = `display: ${show ? '' : 'none'}`}this.setData({displayStyle})},back() {const data = this.dataif (data.delta) {wx.navigateBack({delta: data.delta})}this.triggerEvent('back', { delta: data.delta }, {})}}})

index.json

{"component": true,"usingComponents": {}
}

在頁面中使用該組件
page.json

{"usingComponents": {"zxm-navigation-bar": "/components/zxm-navigation-bar" //該成你所放組件的路徑喲},"navigationStyle": "custom","disableScroll": true
}

page.wxml

<view><zxm-navigation-bar title="標題"></zxm-navigation-bar>
</view>

代碼也可前往這里下載

http://aloenet.com.cn/news/29389.html

相關文章:

  • 自己如何免費做網站重慶營銷型網站建設公司
  • wordpress網站發(fā)布時間網絡推廣求職招聘交流群
  • 電子商務網站建設的過程和步驟廣告聯(lián)盟廣告點擊一次多少錢
  • 微信做單子的網站源碼搜什么關鍵詞能找到網站
  • 消防做設計有什么網站無錫網站建設優(yōu)化公司
  • 做美女網站賺錢千峰培訓可靠嗎?
  • 媒體公關廈門谷歌seo
  • 網絡公司開發(fā)網站今日nba數(shù)據帝
  • 免費企業(yè)建站開源系統(tǒng)企業(yè)培訓師資格證
  • html5網站編寫青島網站制作推廣
  • 網站可以做無形資產嗎優(yōu)化網站排名需要多少錢
  • 云表無代碼開發(fā)平臺baike seotl
  • 網站備案值得嗎打廣告的免費軟件
  • 專業(yè)做化妝品的網站在線生成html網頁
  • 怎么做淘寶客網站做淘客拼多多代運營一般多少錢
  • 佰匯康網站建設河南seo快速排名
  • 南京網站建設案例蘇州做網站哪家比較好
  • 嘉興網站制作軟件如何做一個網站
  • 有沒有幫人做簡歷的網站營銷型網站和普通網站
  • 只做襯衣網站百度seo排名優(yōu)化技巧分享
  • 帝國cms企業(yè)網站模板網站優(yōu)化方案案例
  • 怎么做網站能夠增加人氣鏈接提交入口
  • 政府網站建設方案范文—工作方案seo專員崗位職責
  • wordpress文章審核發(fā)郵件國內seo公司
  • 高端做網站哪家好臨沂seo
  • 人大兩學一做專題網站深圳營銷型網站開發(fā)
  • 建應用網站百度pc網頁版
  • 網站格式圖片全國唯一一個沒有疫情的城市
  • 杭州 網站建設seo引擎優(yōu)化方案
  • 淘寶客網站怎么做推廣windows優(yōu)化大師要會員