123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <view :class="{navbarTran: true, active: active}" :style="{height: `${placeholderHeight}px`}">
- <view :style="{height: `${barHeight}px`, marginTop:`${barTop}px`}">
- <view class="right-icon">
- <view class="right-icon-left">
- <uni-icons type="back" color="#171715" size="24" @click="back"></uni-icons>
- </view>
- <view style="background-color:#7e7e7c; height: 36rpx;width:2rpx; "></view>
- <view class="right-icon-right">
- <text>{{title}}</text>
- </view>
- </view>
-
- </view>
- </view>
- </template>
- <script>
- export default{
- name: "navbarTransparent",
- props:['title'],
- data(){
- return {
- barTop:0,
- barHeight:0,
- placeholderHeight:0,
- active:false,
- timer: 0
- }
- },
- onReady(){
- this.barTop = uni.getSystemInfoSync().statusBarHeight
- const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
- this.barHeight = menuButtonInfo.height + (menuButtonInfo.top - this.barTop) * 2
- this.placeholderHeight = this.barHeight + this.barTop
- },
- onHide(){
- clearInterval(this.timer)
- },
-
- methods:{
- back(){
- uni.navigateBack({
- fail:()=>{
- uni.switchTab({
- url: "/pages/index/index"
- })
- }
- })
- },
-
- }
- }
- </script>
- <style lang="scss" scoped>
- .navbarTran{
- z-index: 100;
- position: fixed;
- top: 0;
- // height: 100rpx;
- width: 100%;
- background-color: transparent;
- transition: 0.3s all;
-
- >view{
- display: flex;
- align-items: center;
- justify-content: flex-start;
- }
- text{
- color:#000;
- font-size: 32rpx;
- text-shadow: 0.1px 0.1px 0.2px #000;
- }
-
- &.active{
- background-color: #fff;
- }
-
-
- .right-icon{
- margin-left: 30rpx;
- width: 174rpx;
- height: 64rpx;
- background: rgba(255,255,255,0.6);
- border-radius: 50rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10rpx 15rpx;
- .right-icon-left{
-
- }
- .right-icon-right{
-
- }
- }
-
-
- }
- </style>
|