123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <view class="u-f-ajc u-f-jsb wbpNavBar" :style="{backgroundColor: bgColor}">
- <view class="wbp-back-content" @click="onBack">
- <image v-if="showBack" :src="bgColor!='#ffffff'?'/static/news/back_icon20.png':'/static/common/back.png'" class="wbp-back"></image>
- </view>
- <text class="wbp-title" :style="{color:titleColor}">{{title}}</text>
- <view v-if="rightTitle.length > 0" class="wbp-right-icon">
- <view v-for="(item,index) in rightTitle" :src="item" :data-index="index" @click="rightTap">
- <text>{{item}}</text>
- </view>
- </view>
- <view v-else class="wbp-right-icon">
- <view v-for="(item,index) in rightIcons" :src="item" :data-index="index" @click="rightTap">
- <image :src="item"></image>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- title: {
- type: String,
- default: "标题"
- },
- rightIcons: {
- type: Array,
- default: () => {
- return []
- }
- },
- rightTitle: {
- type: Array,
- default: () => {
- return []
- }
- },
- bgColor: {
- type: String,
- default: "#ffffff"
- },
- titleColor: {
- type: String,
- default: "#0A0204"
- },
- backgroundImage:{
- type: String,
- default: "#0A0204"
- },
- customOnBack: {
- type: Boolean,
- default: false
- },
- showBack: {
- type: Boolean,
- default: true
- }
- },
- data() {
- return {
- };
- },
- methods: {
- onBack() {
- if (!this.showBack) {
- return;
- }
- if (this.customOnBack) {
- this.$emit("onBack");
- return;
- }
- uni.navigateBack({
- animationType: 'pop-out',
- animationDuration: 200
- });
- },
- rightTap(e) {
- this.$emit("rightTap", {
- index: e.currentTarget.dataset.index
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .wbpNavBar {
- /* #ifdef MP-WEIXIN */
- padding-right: 200rpx;
- width: 550rpx;
- /* #endif */
- /* #ifdef APP-PLUS */
- width: 750rpx;
- /* #endif */
- background-color: #FFFFFF;
- height: 88rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .wbp-back-content {
- width: 140rpx;
- height: 100%;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .wbp-back {
- width: 40rpx;
- height: 40rpx;
- margin-left: 30rpx;
- }
- }
- .wbp-title {
- font-size: 36rpx;
- width: 470rpx;
- text-align: center;
- color: #0A0204;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- word-break: break-all;
- }
- .wbp-right-icon {
- display: flex;
- width: 140rpx;
- flex-direction: row;
- justify-content: flex-end;
- align-items: center;
- height: 100%;
- image {
- width: 40rpx;
- height: 40rpx;
- margin-right: 30rpx;
- }
- text {
- margin-right: 30rpx;
- color: #DF0E14;
- font-size: 32rpx;
- }
- }
- }
- </style>
|