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.
 
 
 

101 lines
2.0 KiB

<template>
<view class="safe-header" :style="{height:navPaddingTop+navHeight+'px'}"></view>
<view class="header" :class="{top:isTop}" :style="{
paddingTop:navPaddingTop+'px',
}">
<view class="header-container" :style="{
height:navHeight+'px',
justifyContent: (isBack?'space-between':'center'),
padding:menuButtonPadding+'px 0'
}">
<view v-show="isBack" class="header-back-button" @click="navBack()">
<u-icon name="arrow-leftward"></u-icon>
</view>
<view class="header-title">
{{title}}
</view>
<view v-show="isBack" class="header-back-button" style="opacity: 0;">
<u-icon name="arrow-rightward"></u-icon>
</view>
</view>
</view>
</template>
<script>
import {
imghost
} from '@/config/host.js';
import api from '@/utils/functions.js';
export default {
props:{
title:{
type:String,
default:'汪汪行天下'
},
isBack:{
type:Boolean,
default:false
},
navToUrl:{
type:String,
default:''
},
},
data() {
return {
loading: true,
navHeight: 32,
navPaddingTop: 47,
headerPadding:4,
isTop:true,
menuButtonPadding:0,
}
},
onShow() {
},
onLoad() {
},
methods: {
init() {
let sysInfo = uni.getStorageSync('sysInfo');
this.navPaddingTop = sysInfo.sysMenuHeight;
this.navHeight = sysInfo.menuButtonHeight;
this.menuButtonPadding = sysInfo.menuButtonPadding;
},
navBack(){
if(this.navToUrl){
uni.navigateTo({
url:this.navToUrl
})
}else{
uni.navigateBack({
delta:1,
fail:()=>{
uni.navigateTo({url:'/pages/Index/index'})
}
});
}
}
},
created() {
this.init()
},
updated() {},
mounted() {
let that = this;
uni.$on('isTop', (data) => {
that.isTop = data;
});
}
}
</script>
<style lang="scss">
@import '@/components/HeaderNav/components/index.scss';
</style>