YZProjectCloud/yanzhu-ui-app/components/navbar/Navbar.vue

83 lines
1.4 KiB
Vue

<template>
<view class="homeheader" :style="'height:'+safeAreaInsetsTop+'px'">
<u-navbar bgColor="#ffffff" :title="titlenav" :placeholder="background=='#FFF'" :titleStyle="{color:`${textcolor}`}"
:leftIconColor="textcolor" @leftClick="backto(url)" leftIcon="arrow-left">
</u-navbar>
<view class="cjnavbar">
<view class="aaa" :style="'height:'+safeAreaInsetsTop+'px;width:100%;background:'+background">
</view>
</view>
</view>
<!-- <view></view> -->
</template>
<script>
export default {
props: {
"titlenav": {
type: String
},
'background': {
type: String,
default: '#FFF'
},
'textcolor': {
type: String,
default: '#000000'
},
'url': {
type: String,
default: ''
},
},
data() {
return {
safeAreaInsetsTop: 0,
}
},
created() {
this.safeAreaInsetsTop = uni.getSystemInfoSync().safeAreaInsets.top + 44;
},
methods:{
backto(e){
if(e){
if(e.includes('http')){
location.href = e
}else{
uni.reLaunch({
url:e
})
}
}else{
uni.navigateBack()
}
}
}
}
</script>
<style lang="scss" scoped>
.homeheader {
display: flex;
align-items: center;
.cjnavbar {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
.aaa {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 10;
}
}
}
</style>