12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <view class="page-header">
- <view class="status-bar"></view>
- <view class="navbar" :style=" cssStyle ">
- <view class="navbar-left">
- <view class="back-icon" @click="goBack">
- <uni-icons type="left" size="20" color="#000000"></uni-icons>
- </view>
- </view>
- <view class="navbar-title">
- {{ title }}
- <slot name="center"></slot>
- </view>
- <view class="navbar-right">
- <slot name="right"></slot>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'PageHeader',
- props: {
- title: {
- type: String,
- default: ''
- },
- cssStyle:{
- type: Object,
- default: () => ({})
- }
- },
- methods: {
- goBack() {
- uni.navigateBack({
- delta: 1
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .page-header {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 100;
- background-color: #ffffff;
- }
- .status-bar {
- height: var(--status-bar-height);
- }
- .navbar {
- display: flex;
- align-items: center;
- height: 90rpx;
- padding: 0 30rpx;
- }
- .navbar-left {
- width: 120rpx;
- }
- .navbar-title {
- flex: 1;
- text-align: center;
- font-size: 36rpx;
- font-weight: bold;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .navbar-right {
- width: 120rpx;
- text-align: right;
- }
- .back-icon {
- width: 40rpx;
- height: 40rpx;
- }
- </style>
|