中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

如何做外賣網(wǎng)站app東莞百度搜索網(wǎng)站排名

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

在頁(yè)面中實(shí)現(xiàn)自定義頭部導(dǎo)航的組件,如果僅是單個(gè)頁(yè)面中需要自定義可在頁(yè)面的json文件中配置"navigationStyle": “custom”,如果是項(xiàng)目中所有頁(yè)面都想使用自定義的組件,可在app.json的window中全局配置"navigationStyle": “custom”。
先分析頭部導(dǎo)航的組成,可參考圖1
圖1
其組成主要包含兩部分:狀態(tài)欄、導(dǎo)航區(qū)域,下面分別說說這兩部分的高度如何獲取。
1、獲取狀態(tài)欄高度
對(duì)于不同的機(jī)型而言,狀態(tài)欄的高度是有所差異的,可通過wx.getSystemInfo來獲取,但需要注意的是該接口在基礎(chǔ)庫(kù)2.20.1后就停止維護(hù),需要改用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、導(dǎo)航區(qū)域高度
(1)導(dǎo)航區(qū)域的高度可自己定義,但考慮到右側(cè)膠囊,為使得標(biāo)題位置垂直居中,因而導(dǎo)航區(qū)域的高度實(shí)際也需要計(jì)算得出。其公式為:導(dǎo)航區(qū)域的高度 = 膠囊的高度 + 膠囊距離狀態(tài)欄的高度 * 2。

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

在這里插入圖片描述

// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標(biāo)信息以屏幕左上角為原點(diǎn)。
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)考慮到膠囊位置,因而導(dǎo)航欄區(qū)域可自定義的寬度需減去膠囊的寬度,使用padding-right的方式占用膠囊的寬,注意需要設(shè)置為box-sizing: border-box,懂得都懂。
在這里插入圖片描述

// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標(biāo)信息以屏幕左上角為原點(diǎn)。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 // 在組件定義時(shí)的選項(xiàng)中啟用多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: {// 顯示隱藏的時(shí)候opacity動(dòng)畫效果type: Boolean,value: true},show: {// 顯示隱藏導(dǎo)航,隱藏的時(shí)候navigation-bar的高度占位還在type: Boolean,value: true,observer: '_showChange'},// back為true的時(shí)候,返回的頁(yè)面深度delta: {type: Number,value: 1}},/*** 組件的初始數(shù)據(jù)*/data: {displayStyle: '',statusBarHeight: 20},attached() {// 獲取菜單按鈕(右上角膠囊按鈕)的布局位置信息。坐標(biāo)信息以屏幕左上角為原點(diǎn)。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": {}
}

在頁(yè)面中使用該組件
page.json

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

page.wxml

<view><zxm-navigation-bar title="標(biāo)題"></zxm-navigation-bar>
</view>

代碼也可前往這里下載

http://www.risenshineclean.com/news/29389.html

相關(guān)文章:

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