es-nav-bg-black.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="flex-container" :style="'height:'+h+'px'" >
  3. <view class="es-fix-top" :style="(bg?'background: inherit;':'')+'background:'+top_color" >
  4. <es-top></es-top>
  5. <es-nav-title-base :title="title" :left="left" :right="right"></es-nav-title-base>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name:"es-nav-bg-black",
  12. data() {
  13. return {
  14. top_color: '#FFFFFF',
  15. h:44,
  16. };
  17. },
  18. props: [
  19. 'title', 'bg', 'left', 'mode','right','rightCon'
  20. ],
  21. created: function() {
  22. let data = getApp().globalData;
  23. if(data.__czy_h)
  24. {
  25. this.h = data.__czy_h;
  26. }else{
  27. uni.getSystemInfo({
  28. success: (res) => {
  29. let top = res.safeArea.top;
  30. data.__czy_h = this.h = top+44;
  31. }
  32. });
  33. }
  34. },
  35. methods: {
  36. close: function() {
  37. const pages = getCurrentPages();
  38. const currentPageIndex = pages.length - 1; // 当前页面的索引
  39. const targetPageIndex = 1; // 假设要返回到首页(页面 A)
  40. // 计算需要返回的层数
  41. const delta = currentPageIndex - targetPageIndex;
  42. uni.navigateBack({
  43. delta: delta,
  44. animationType: 'pop-out',
  45. animationDuration: 200
  46. });
  47. },
  48. // scrollBody:function(e){
  49. // let top = e.scrollTop / this.h;
  50. // this.top_color = 'rgba(255,92,3, ' + top + ')';
  51. // }
  52. }
  53. }
  54. </script>
  55. <style>
  56. .flex-container {
  57. display: flex;
  58. flex-direction: column;
  59. min-height: 88rpx;
  60. }
  61. .es-fix-top {
  62. background-size: 100% auto;
  63. background-repeat: no-repeat;
  64. }
  65. .es-h-88 {
  66. height: 44px;
  67. }
  68. .es-fix-top {
  69. font-weight: 620;
  70. font-family: PingFang SC;
  71. color: white;
  72. }
  73. .top-img {
  74. width: 100%;
  75. height: 500rpx;
  76. position: absolute;
  77. }
  78. .top-close {
  79. left: 30rpx;
  80. position: absolute;
  81. bottom: 0rpx;
  82. width: 100rpx;
  83. height: 80rpx;
  84. }
  85. .navTitle{
  86. left: calc(50% - 80rpx);
  87. top:10rpx;
  88. position: absolute;
  89. width: 80rpx;
  90. height: 70rpx;
  91. line-height: 70rpx;
  92. color: #fff;
  93. font-size: 30rpx;
  94. font-weight: 500;
  95. }
  96. </style>