朱桂飞
2023-04-03 458962a2e4a4f6af0caa5fcb3867f2e42125fd40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<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':'',bgColor]">
                <view class="action" @tap="BackPage" v-if="isBack">
                    <text class="cuIcon-back"></text>
                    <slot name="backText"></slot>
                </view>
        <view class="left-action" v-if="!isBack">
            <slot name="left"></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 {
    name: 'TnCustom',
        data() {
            return {
                StatusBar: this.StatusBar,
                CustomBar: this.CustomBar
            };
        },
        computed: {
            style() {
                const StatusBar= this.StatusBar;
                const CustomBar= this.CustomBar;
                const bgImage = this.bgImage;
                const style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
                if (this.bgImage) {
                    style = `${style}background-image:url(${bgImage});`;
                }
                return style
            }
        },
        props: {
            bgColor: {
                type: String,
                default: ''
            },
            isBack: {
                type: [Boolean, String],
                default: false
            },
      isLeft: {
        type: [Boolean, String],
        default: false
      },
            bgImage: {
                type: String,
                default: ''
            },
        },
        methods: {
            BackPage() {
                uni.navigateBack({
                    delta: 1
                });
            }
        }
    }
</script>
 
<style scoped>
  .cu-bar .left-action {
      font-size: 30rpx;
  }
  .TN_navbg {
      margin: 0; 
      /* width: 100%; 
      height: 100vh; */ 
      color: #fff; 
    background: linear-gradient(45deg,#F15BB5, #9A5CE5, #01BEFF,#00F5D4); 
      background-size: 500% 500%; 
      animation: gradientBG 15s ease infinite; 
  } 
   
  @keyframes gradientBG { 
      0% { 
          background-position: 0% 50%; 
      } 
      50% { 
          background-position: 100% 50%; 
      } 
      100% { 
          background-position: 0% 50%; 
      } 
  }
</style>