You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.2 KiB
67 lines
1.2 KiB
<template>
|
|
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
|
<view class="nav-content">
|
|
<image class="back-btn" src="/static/back.png" mode="aspectFit" @click="onBack" />
|
|
<text class="nav-title">{{ title }}</text>
|
|
<view class="right-slot">
|
|
<slot name="right"></slot>
|
|
</view>
|
|
</view>
|
|
<slot></slot>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
statusBarHeight: 0
|
|
}
|
|
},
|
|
mounted() {
|
|
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0;
|
|
},
|
|
methods: {
|
|
onBack() {
|
|
console.log('onBack');
|
|
uni.navigateBack();
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.nav-bar {
|
|
background: transparent;
|
|
}
|
|
.nav-content {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 44px;
|
|
padding: 0 16px;
|
|
}
|
|
.back-btn {
|
|
width: 16px;
|
|
height: 16px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.nav-title {
|
|
font-size: 16px;
|
|
font-weight: normal;
|
|
color: #222;
|
|
flex: 1;
|
|
text-align: center;
|
|
}
|
|
.right-slot {
|
|
min-width: 24px;
|
|
}
|
|
</style> |