知識(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)站建設(shè)公司
- 云南網(wǎng)站建設(shè)方法
- 云南小程序開(kāi)發(fā)公司
- 專業(yè)網(wǎng)站建設(shè)公司
- 云南軟件設(shè)計(jì)
- 定制小程序開(kāi)發(fā)
- 云南網(wǎng)站建設(shè)公司地址
- 楚雄小程序開(kāi)發(fā)
- 百度小程序
- 網(wǎng)站優(yōu)化哪家好
- 云南小程序定制
- 前端技術(shù)
- 云南網(wǎng)站建設(shè)專家
- 云南省建設(shè)廳官方網(wǎng)站
- 網(wǎng)站建設(shè)首選
- 云南省建設(shè)廳網(wǎng)站官網(wǎng)
- 網(wǎng)站開(kāi)發(fā)
- Web開(kāi)發(fā)框架
- 分銷系統(tǒng)
- 昆明小程序設(shè)計(jì)
- 商標(biāo)
- 制作一個(gè)小程序
- 報(bào)廢車
- 汽車報(bào)廢拆解管理系統(tǒng)
- 云南網(wǎng)站建設(shè)列表網(wǎng)
- 云南衛(wèi)視小程序
- 百度快速排名
- 小程序制作
- 云南網(wǎng)站建設(shè)招商
- 云南網(wǎng)站優(yōu)化公司