12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template name="page-head">
- <view class="topBar" :style="'padding-top:'+buttonTop+'px;height:'+statusNavBarHeight+'px;background:'+background+';color:'+color">
- <view class="back" :style="'height:'+buttonHeight+'px'" v-if="isBack" @click="back">
- <image class="back_image" src="/static/logo.png" v-if="color=='#ffffff'"></image>
- <image v-else class="back_image" src="/static/icon.png"></image>
- </view>
- <text class="topBar_title" :style="'top:'+buttonTop+'px;line-height:'+buttonHeight+'px'">{{title}}</text>
- </view>
- </template>
- <script>
- export default {
- name:"page-head",
- props: {
- title: {
- type: String,
- default: "问星数据 - 抖音版"
- },
- background:{
- type:String,
- default:"#f2f2f2"
- },
- color:{
- type:String,
- default:"#666666"
- },
- isBack:{
- type:Boolean,
- default:false
- }
- },
- data() {
- return {
- buttonTop:this.$store.state.systemInfo.safeAreaInsets.top,
- statusNavBarHeight:this.$store.state.systemInfo.safeAreaTop,
- buttonHeight:this.$store.state.systemInfo.statusBarHeight,
- };
- },
- methods:{
- back(){
- let pages = getCurrentPages(); //页面对象
- let prevpage = pages[pages.length - 2];
- if(prevpage) {
- uni.navigateBack()
- }else {
- uni.redirectTo({
- url:'../pages/index/index?page=homePage'
- })
- }
- }
- }
- }
- </script>
- <style>
- .topBar{
- background: #f2f2f2;
- position: fixed;
- left: 0;
- top: 0rpx;
- width: 100%;
- height: var(--status-bar-height);;
- color: #FFFFFF;
- z-index: 999;
- box-sizing: border-box;
- }
- .topBar_title{
- font-size: 32rpx;
- line-height: 44rpx;
- position: absolute;
- width: 50%;
- left: 0;
- right: 0;
- margin:auto;
- text-align: center;
- }
- .back {
- width: 80rpx;
- height: 40rpx;
- margin-left: 10rpx;
- position: relative;
- }
- .back_image{
- width: 34rpx;
- height: 34rpx;
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- }
- </style>
|