知識(shí)
不管是網(wǎng)站,軟件還是小程序,都要直接或間接能為您產(chǎn)生價(jià)值,我們?cè)谧非笃湟曈X(jué)表現(xiàn)的同時(shí),更側(cè)重于功能的便捷,營(yíng)銷的便利,運(yùn)營(yíng)的高效,讓網(wǎng)站成為營(yíng)銷工具,讓軟件能切實(shí)提升企業(yè)內(nèi)部管理水平和效率。優(yōu)秀的程序?yàn)楹笃谏?jí)提供便捷的支持!
您當(dāng)前位置>首頁(yè) » 新聞資訊 » 小程序相關(guān) >
支付寶小程序自定義頭部組件
發(fā)表時(shí)間:2020-9-21
發(fā)布人:葵宇科技
瀏覽次數(shù):123
支付寶小程序自定義頭部組件
view
<view class="nav-header" style="height:{{navbarData.isFloat?0:statusBarHeight+titleBarHeight}}px">
<view class="nav-top">
<image a:if="{{navbarData.isBgImg}}" src="/images/user-bg.png" class="headder-bg" style="width:100%;height:{{statusBarHeight+titleBarHeight}}px;"></image>
<view class="nav-status-bar" style="height:{{statusBarHeight}}px"></view>
<view class="nav-title-bar" style="height:{{titleBarHeight}}px">
<view class="nav-left">
<slot name="header-left"></slot>
</view>
<view class="nav-title-text" style="line-height:{{titleBarHeight}}px;">
<text>{{navbarData.title}}</text>
</view>
</view>
</view>
</view>
js
const app = getApp()
Component({
props: {
navbarData: {}
},
data: {
statusBarHeight: '',
titleBarHeight: ''
},
didMount: function () {
this.setData({
statusBarHeight: app.globalData.statusBarHeight,
titleBarHeight: app.globalData.titleBarHeight
})
},
methods: {
}
})
css
.nav-header{
width: 100%;
}
.nav-top{
width: 100%;
height: auto;
position: fixed;
left: 0;
top: 0;
z-index: 99;
background: transparent;
}
.nav-status-bar{
width: 100%;
background: transparent;
}
.nav-title-bar{
width: 100%;
position: relative;
background: transparent;
}
.nav-title-text{
width: 100%;
/* font-size: 40rpx; */
color: white;
text-align: center;
position: absolute;
left: 0;
top: 0;
z-index: 2;
}
.nav-title-text text{
position: relative;
top: 6rpx;
}
.nav-left{
position: absolute;
left: 0;
top: 0;
z-index: 3;
}
.headder-bg{
position: absolute;
left: 0;
top: 0;
z-index: 1
}
實(shí)戰(zhàn):
組件上使用
<navbar navbar-data="{{nvabarData}}" />
// 引用
nvabarData: {
isFloat: true,
title: '喜刷' //導(dǎo)航欄 中間的標(biāo)題
},
height: '',
onLoad() {
// 獲取用戶數(shù)據(jù)
this.setData({
height: app.globalData.statusBarHeight + app.globalData.titleBarHeight,
})
相關(guān)案例查看更多
相關(guān)閱讀
- 河南小程序制作
- 支付寶小程序被騙
- 云南網(wǎng)站維護(hù)
- 百度小程序
- web
- 網(wǎng)絡(luò)公司哪家好
- 云南省建設(shè)廳官方網(wǎng)站
- 報(bào)廢車管理
- 昆明網(wǎng)站開(kāi)發(fā)
- 昆明軟件定制公司
- 昆明網(wǎng)站制作
- 小程序開(kāi)發(fā)課程
- web開(kāi)發(fā)技術(shù)
- 云南網(wǎng)站建設(shè)專家
- 云南網(wǎng)絡(luò)公司
- 云南網(wǎng)站制作哪家好
- web教程
- 網(wǎng)站優(yōu)化哪家好
- 區(qū)塊鏈
- 汽車回收管理
- 用戶登錄
- 網(wǎng)站建設(shè)費(fèi)用
- 微信小程序開(kāi)發(fā)入門課程
- 人人商城
- 花農(nóng)小程序
- 汽車報(bào)廢軟件
- 小程序生成海報(bào)
- 云南小程序制作
- python開(kāi)發(fā)小程序
- 小程序被騙