123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <template>
- <view class="zaiui-bar-title-box" :style="isWechatBrowser ? 'display: none;' : ''">
- <view class="cu-bar" :class="[fixed?'fixed':'', shadow?'':'no-shadow', bgColor]">
- <view class="action" @tap="BackPage" v-if="isBack">
- <text class="cuIcon-back"/>
- <text>{{backText}}</text>
- </view>
- <view class="action" @tap="leftTap" v-if="!isBack">
- <slot name="left"/>
- </view>
- <view class="content" @tap="contentTap">
- <slot name="content"/>
- </view>
- <view class="action" @tap="rightTap">
- <!--小程序端不显示-->
- <!-- #ifndef MP -->
- <slot name="right"/>
- <!-- #endif -->
- </view>
- </view>
- <!--占位的-->
- <view class="zaiui-seat-height" v-if="fixed"/>
- </view>
- </template>
- <script>
- export default {
- name: 'bar-title',
- props: {
- bgColor: {
- type: String,
- default: ''
- },
- isBack: {
- type: Boolean,
- default: true
- },
- backText: {
- type: String,
- default: ""
- },
- fixed: {
- type: Boolean,
- default: true
- },
- shadow: {
- type: Boolean,
- default: false
- },
- title: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- isWechatBrowser: false
- }
- },
- methods: {
- BackPage() {
- uni.navigateBack();
- },
- leftTap() {
- this.$emit('leftTap');
- },
- contentTap() {
- this.$emit('contentTap');
- },
- rightTap() {
- this.$emit('rightTap');
- }
- },
- created() {
- uni.setNavigationBarTitle({
- title: this.title
- })
- this.isWechatBrowser = navigator.userAgent.toLocaleLowerCase().indexOf('micromessenger') > 0
- }
- }
- </script>
- <style lang="scss" scoped>
- .zaiui-bar-title-box {
- .cu-bar {
- padding-top: var(--status-bar-height);
- min-height: calc(var(--status-bar-height) + 101upx);
- .content {
- top: var(--status-bar-height);
- .cu-tag {
- position: relative;
- top: -2.72upx;
- padding: 0 5.45upx;
- text {
- position: relative;
- top: 2upx;
- }
- }
- }
- }
- .cu-bar.fixed.no-shadow {
- box-shadow: inherit;
- }
- .cu-bar.bg-white {
- color: #333333;
- }
- .zaiui-seat-height {
- width: 100%;
- height: calc(var(--status-bar-height) + 101upx);
- }
- }
- </style>
|