123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <view>
- <view class="cu-custom" :style="[{height:CustomBar + 'px'}]">
- <view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'', bgColorClass]">
- <view class="action" @tap="BackPage" v-if="isBack">
- <text class="cuIcon-back"></text>
- <slot name="backText"></slot>
- </view>
- <view class="content" :style="[{top:StatusBar + 'px'}]">
- <slot name="content"></slot>
- </view>
- <slot name="right"></slot>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- StatusBar: this.StatusBar,
- CustomBar: this.CustomBar,
- bgColorClass : 'bg-gradual-pink',
- };
- },
- name: 'cu-custom',
- computed: {
- style() {
- var StatusBar= this.StatusBar;
- var CustomBar= this.CustomBar;
- var bgImage = this.bgImage;
- var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
- if (this.bgColor) {
- var bgColor = this.bgColor;
- style = `${style};${bgColor};`;
- } else if (this.bgImage) {
- style = `${style}background-image:url(${bgImage});`;
- }
-
- return style
- }
- },
- props: {
- bgColor: {
- type: String,
- default: ''
- },
- isBack: {
- type: [Boolean, String],
- default: false
- },
- bgImage: {
- type: String,
- default: ''
- },
- },
- methods: {
- BackPage() {
- if (this.Dever.source == 'h5') {
- window.history.back();
- } else {
- if (getCurrentPages().length < 2 && 'undefined' !== typeof __wxConfig) {
- let url = '/' + __wxConfig.pages[0]
- return uni.redirectTo({url})
- }
- uni.navigateBack({
- delta: 1
- });
- }
- }
- }
- }
- </script>
- <style>
- </style>
|