freight-web/src/components/NavBar/NavBarLayout.vue

70 lines
1.3 KiB
Vue

<template>
<view
:style="{
paddingTop: navbarRect.top + 'px',
height: navbarRect.height + 'px',
}"
class="navbar"
>
<view class="left" @click="handleMsg()">
</view>
<view class="title">个人中心</view>
</view>
</template>
<script setup lang="ts">
const navbarRect = reactive({
height: 42,
top: 48,
msgCount: 10,
});
onMounted(() => {
// #ifdef MP-WEIXIN
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
navbarRect.height = menuButtonInfo.height;
navbarRect.top = menuButtonInfo.top;
// #endif
});
const handleMsg = () => {
uni.navigateTo({
url: "/pagesLogin/message/index", // 要跳转到的页面路径
});
};
</script>
<style lang="scss">
.navbar {
background: #f9f9f9;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.18);
padding: 15rpx;
position: fixed;
width: 100%;
top: 0;
left: 0;
right: 0;
z-index: 999;
.left {
position: absolute;
margin-top: 10px;
.msg-badge {
margin-left: 20rpx;
font-size: 16rpx;
padding: 2px 4px;
position: absolute;
z-index: 9;
margin-top: -10px;
}
}
.title {
font-size: 32rpx;
font-family: Source Han Sans CN;
font-weight: 500;
color: #000000;
line-height: 41rpx;
text-align: center;
padding: 5px;
}
}
</style>