当前位置:网站首页>Uniapp custom header component
Uniapp custom header component
2022-07-18 08:42:00 【Little eight hairs】
Officially uni-nav-bar
<template>
<view class="nav-box" :style="{lineHeight:toBar + 'px',paddingTop:statusBarHeight+'px'}">
<view class="nav-top-one">
<view @click="backpage" class="icon">
<uni-icons type="arrowleft" color="#fffff" size="23"></uni-icons>
</view>
</view>
<view class="nav-top-text">
{
{titleName}}
</view>
<view class="nav-top-right">
<slot></slot>
</view>
</view>
</template>
<script>
export default {
name: "cus-navbar",
props: {
titleName: {
type: String,
}
},
data() {
return {
statusBarHeight: '', // The height of the status bar
toBar: '', // The height of the title bar
};
},
onReady() {
this.getPhoneHeight();
},
methods: {
getPhoneHeight() { // Get height
let that = this;
uni.getSystemInfo({
success: function(res) {
if (res.platform == "ios") {
that.toBar = 44;
} else if (res.platform == "android") {
that.toBar = 44;
} else {
that.toBar = 44;
}
that.statusBarHeight = res.statusBarHeight; // The height of the status bar
},
});
},
backpage() {
uni.navigateBack({delta: 1});
},
},
};
</script>
<style scoped>
.nav-box {
padding-left: 6rpx;
background-color: #0062fe;
color: #fff;
display: grid;
grid-template-columns: 0fr 4fr 2fr 3fr;
gap: 5px;
}
.nav-top-text {
text-align: left;
}
.nav-top-right {
text-align: right;
}
</style>
边栏推荐
- Umask calculates the default permissions for creating files and directories
- docker mysql容器如何开启慢查询日志
- Common differences between MySQL and Oracle (2)
- Event 4624 is login successful!?! Is that true?
- PolarDB for PostgreSQL的HTAP跨机并行查询的执行方法是什么?
- Qt(六)数值与字符串转换
- Selenium使用之解决‘chromedriver‘ executable needs to be in PATH.报错信息
- Logic of archives | holonomic distinction and examples
- MySQL reports an error mysqld:sort aborted:server shutdown in progress reason
- Refute 'all management without assessment is nonsense'
猜你喜欢
随机推荐
Swift 自定义Subscript
Golang优秀开源项目汇总
第三讲:spfa求最短路
Event 4624 is login successful!?! Is that true?
【Leetcode周赛--哈希表模拟】6113.无限集中的最小数字
父游标、子游标及共享游标
Solutions to SSL and time zone errors when using JDBC to operate the database
About March 2022, apt-c-41 disguised as winrar Exe attack terminal side emergency response troubleshooting point
【Leetcode二叉树--最大路径和】124.二叉树中的最大路径和
Leecode subarray XOR query
"Smart factory" goes online, breaking the traditional factory digital transformation
如何清理你的电子邮件订阅者名单以改善电子邮件营销
290 pages 110000 words digital agriculture rural project planning and construction scheme 2022
Go1.18升级功能 - 模糊测试Fuzz | 从零开始Go语言
How can home building materials enterprises build a smart supply chain management system? Digital commerce cloud supply chain system focuses on multi business application scenarios of procurement and
【集训DAY4】Forging【期望DP】
The physical meaning of Fourier transform
The logic of archives | archives collection
One article understand go integrate CAPTCHA to realize the function of verification code
C# Channel 简单实现消息队列的发布、订阅









