| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <view class="cu-custom" :style="[{ height: CustomBar + 'px' }]">
- <view v-if="linear" class="fixed-bg liner-ground liner-height"></view>
- <view class="cu-bar fixed" :style="style" :class="[bgImage != '' ? 'none-bg text-white bg-img' : '', bgColor]">
- <view class="action" v-if="isBack">
- <text class="cuIcon-back cu-back text-white" @tap="BackPage" v-if="showBackIcon"></text>
- <slot name="backText"></slot>
- </view>
- <view class="content text-white" style="font-weight: 600;" :style="[{ top: StatusBar + 'px' }]"><slot name="content"></slot></view>
- <view style="margin-left: auto;margin-right: 15rpx;color: #fff;font-size: 14px;font-weight: 500;"><slot name="right"></slot></view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- StatusBar: this.StatusBar,
- CustomBar: this.CustomBar
- };
- },
- 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.bgImage) {
- style = `${style}background-image:url(${bgImage});`;
- }
- return style;
- }
- },
- props: {
- bgColor: {
- type: String,
- default: ''
- },
- linear: {
- type: Boolean,
- default: false
- },
- isBack: {
- type: [Boolean, String],
- default: false
- },
- showBackIcon: {
- type: Boolean,
- default: true
- },
- bgImage: {
- type: String,
- default: ''
- }
- },
- methods: {
- BackPage() {
- uni.navigateBack({
- delta: 1
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .liner-height{
- height: 20vh;
- }
- .fixed-bg{
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- z-index: 0;
- transform: translateZ(-100px);
- mix-blend-mode: screen;
- pointer-events: none;
- }
- .liner-ground{
- background: linear-gradient(180deg, #2cc8a6 44px, transparent);
- }
- </style>
|