nav-bar.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="cu-custom" :style="[{ height: 0 + 'px' }]">
  3. <view class="cu-bar fixed" :style="style" :class="[bgImage != '' ? 'none-bg text-white bg-img' : '', bgColor]">
  4. <view class="action" v-if="isBack">
  5. <text class="cuIcon-back cu-back text-white" @tap="BackPage" v-if="showBackIcon"></text>
  6. <slot name="backText"></slot>
  7. </view>
  8. <view class="content text-white" style="font-weight: 600;" :style="[{ top: StatusBar + 'px' }]">
  9. <image src="/static/app/page1/nav_bg.png" mode="aspectFill" style="width: 129rpx;height: 53rpx;"></image>
  10. </view>
  11. <view style="margin-left: auto;margin-right: 15rpx;color: #fff;font-size: 14px;font-weight: 500;">
  12. <slot name="right"></slot>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. StatusBar: this.StatusBar,
  22. CustomBar: this.CustomBar
  23. };
  24. },
  25. name: 'cu-custom',
  26. computed: {
  27. style() {
  28. var StatusBar = this.StatusBar;
  29. var CustomBar = this.CustomBar;
  30. var bgImage = this.bgImage;
  31. var navOpacity = this.navOpacity;
  32. var style = `height:${CustomBar}px;padding-top:${StatusBar}px;background:rgba(255,255,255, ${navOpacity});`;
  33. return style;
  34. },
  35. },
  36. props: {
  37. navOpacity: {
  38. type: Number,
  39. default: 0
  40. },
  41. bgColor: {
  42. type: String,
  43. default: ''
  44. },
  45. linear: {
  46. type: Boolean,
  47. default: false
  48. },
  49. isBack: {
  50. type: [Boolean, String],
  51. default: false
  52. },
  53. showBackIcon: {
  54. type: Boolean,
  55. default: true
  56. },
  57. bgImage: {
  58. type: String,
  59. default: ''
  60. }
  61. },
  62. methods: {
  63. BackPage() {
  64. uni.navigateBack({
  65. delta: 1
  66. });
  67. }
  68. }
  69. };
  70. </script>
  71. <style lang="scss">
  72. .liner-height{
  73. height: 20vh;
  74. }
  75. .fixed-bg{
  76. position: absolute;
  77. top: 0;
  78. left: 0;
  79. right: 0;
  80. z-index: 0;
  81. transform: translateZ(-100px);
  82. pointer-events: none;
  83. background-image:linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
  84. mix-blend-mode: color-burn;
  85. }
  86. .text-white{
  87. color: #C5C5C5;
  88. }
  89. </style>