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.
41 lines
1.1 KiB
41 lines
1.1 KiB
<template>
|
|
<u-sticky zIndex="99999">
|
|
<u-navbar fixed :auto-back="false" :bgColor="bgColor" :status-bar-bg-color="bgColor" placeholder :title="title" safeAreaInsetTop
|
|
:title-style="{color: 'white'}" auto-back left-icon-color="white" @leftClick="leftClick">
|
|
<template slot="left">
|
|
<u-icon :name="currentPages.length > 1 ? 'arrow-left' : 'home'" size="20" color="white" v-if="showBack"/>
|
|
</template>
|
|
</u-navbar>
|
|
</u-sticky>
|
|
</template>
|
|
|
|
<script>
|
|
import {LINEAR} from "@/config/color";
|
|
|
|
export default {
|
|
name: "HeaderItem",
|
|
props: {
|
|
title: String,
|
|
showBack: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
bgColor: LINEAR,
|
|
currentPages: []
|
|
}
|
|
},
|
|
methods: {
|
|
leftClick() {
|
|
console.log(this.currentPages)
|
|
if (this.currentPages.length === 1) uni.switchTab({url: '/pages/index/index'})
|
|
// else uni.navigateBack()
|
|
}
|
|
},
|
|
mounted() {
|
|
this.currentPages = getCurrentPages()
|
|
}
|
|
}
|
|
</script>
|