| | |
| | | <template> |
| | | <view class="guide-nav-bar" :style="navStyle"> |
| | | <view class="guide-nav-bar" :class="'is-' + theme" :style="navStyle"> |
| | | <view class="guide-nav-bar__row"> |
| | | <button v-if="showBack" class="guide-nav-bar__back" @tap="handleBack"> |
| | | <image class="guide-nav-bar__icon" src="/static/icons/chevron-left-white.svg" mode="aspectFit" /> |
| | | </button> |
| | | <view v-if="showBack" class="guide-nav-bar__back" @tap="handleBack"> |
| | | <image class="guide-nav-bar__icon" :src="backIcon" mode="aspectFit" /> |
| | | </view> |
| | | <text class="guide-nav-bar__title">{{ title }}</text> |
| | | <view v-if="actionText" class="guide-nav-bar__action" @tap="handleAction"> |
| | | <text class="guide-nav-bar__action-text">{{ actionText }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | |
| | | backgroundColor: { |
| | | type: String, |
| | | default: '#4d8fe8' |
| | | }, |
| | | actionText: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | theme: { |
| | | type: String, |
| | | default: 'brand' |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | } |
| | | }, |
| | | computed: { |
| | | isLight() { |
| | | return this.theme === 'light' |
| | | }, |
| | | backIcon() { |
| | | return this.isLight ? '/static/icons/chevron-left.svg' : '/static/icons/chevron-left-white.svg' |
| | | }, |
| | | barBackground() { |
| | | if (this.isLight && this.backgroundColor === '#4d8fe8') { |
| | | return '#f4f6f9' |
| | | } |
| | | return this.backgroundColor |
| | | }, |
| | | navHeightPx() { |
| | | return this.statusBarHeight + upxToPx(98) |
| | | }, |
| | |
| | | return { |
| | | paddingTop: `${this.statusBarHeight}px`, |
| | | height: `${this.navHeightPx}px`, |
| | | background: this.backgroundColor |
| | | background: this.barBackground |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | handleBack() { |
| | | this.$emit('back') |
| | | }, |
| | | handleAction() { |
| | | this.$emit('action') |
| | | } |
| | | } |
| | | } |
| | |
| | | width: 88rpx; |
| | | height: 64rpx; |
| | | padding: 0; |
| | | border: 0; |
| | | background: transparent; |
| | | transform: translateY(-50%); |
| | | } |
| | | |
| | | .guide-nav-bar__back::after { |
| | | border: 0; |
| | | } |
| | | |
| | | .guide-nav-bar__icon { |
| | |
| | | } |
| | | |
| | | .guide-nav-bar__title { |
| | | max-width: 460rpx; |
| | | max-width: 360rpx; |
| | | color: #ffffff; |
| | | font-size: 32rpx; |
| | | font-weight: 800; |
| | |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .guide-nav-bar__action { |
| | | position: absolute; |
| | | right: 24rpx; |
| | | top: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | min-width: 104rpx; |
| | | height: 52rpx; |
| | | padding: 0 22rpx; |
| | | border-radius: 10rpx; |
| | | background: #ffffff; |
| | | transform: translateY(-50%); |
| | | } |
| | | |
| | | .guide-nav-bar__action-text { |
| | | color: #4d8fe8; |
| | | font-size: 26rpx; |
| | | font-weight: 700; |
| | | line-height: 1; |
| | | } |
| | | |
| | | .guide-nav-bar.is-light .guide-nav-bar__title { |
| | | color: #202b3e; |
| | | font-size: 34rpx; |
| | | font-weight: 700; |
| | | } |
| | | |
| | | .guide-nav-bar.is-light .guide-nav-bar__icon { |
| | | width: 38rpx; |
| | | height: 38rpx; |
| | | } |
| | | </style> |