吉光研途前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
3.5 KiB

3 months ago
1 month ago
3 months ago
1 month ago
1 month ago
1 month ago
3 months ago
1 month ago
3 months ago
1 month ago
3 months ago
1 month ago
3 months ago
  1. <template>
  2. <!-- <view class="navbar"
  3. :style="{backgroundColor : bgColor}"> -->
  4. <view class="title navbar__view"
  5. :style="{backgroundColor : bgColor,color}">
  6. <view class="nav">
  7. <image class="nav-bg" src="@/static/image/bg-nav.png" mode="aspectFill"></image>
  8. <image class="nav-logo" src="@/static/image/bg-icon.png" mode="heightFix"></image>
  9. <!-- <image class="nav-icon" src="@/static/image/icon-question.png" mode="widthFix"></image> -->
  10. <view class="main">
  11. <view class="left">
  12. <uv-icon name="home"
  13. v-if="leftClick && length == 1"
  14. @click="toHome"
  15. :color="color" size="46rpx"></uv-icon>
  16. <button v-else-if="leftClick" class="btn btn-back" @click="$emit('leftClick')" >
  17. <image class="btn-back-icon" src="@/static/image/icon-back.png" mode="widthFix"></image>
  18. </button>
  19. </view>
  20. <view>{{ title }}</view>
  21. <view class="icon">
  22. <uv-icon name="search"
  23. v-if="isSearch"
  24. :color="color" size="58rpx"></uv-icon>
  25. <uv-icon name="plus-circle" :color="color"
  26. v-if="isPlus"
  27. @click="plusCircleShow = true"
  28. size="46rpx" style="margin-left: 30rpx;"></uv-icon>
  29. <view v-if="moreClick" style="margin-left: 30rpx;">
  30. <uv-icon name="more-dot-fill" :color="color"
  31. v-if="!moreText"
  32. @click="moreClick()"
  33. size="46rpx"></uv-icon>
  34. <view v-else @click="moreClick"
  35. style="font-weight: 400;font-size: 30rpx;">
  36. {{ moreText }}
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- </view> -->
  44. </template>
  45. <script>
  46. export default {
  47. name:"navbar",
  48. props : {
  49. title : {
  50. type : String,
  51. default : ''
  52. },
  53. leftClick : {
  54. type : Boolean,
  55. },
  56. moreClick : {
  57. type : Function,
  58. },
  59. isSearch : {
  60. type : Boolean,
  61. default : false,
  62. },
  63. isPlus : {
  64. type : Boolean,
  65. default : false,
  66. },
  67. moreText : {
  68. },
  69. bgColor : {
  70. default : '#fff'
  71. },
  72. color : {
  73. default : '#666666'
  74. }
  75. },
  76. created() {
  77. },
  78. beforeDestroy() {
  79. },
  80. data() {
  81. return {
  82. length : getCurrentPages().length
  83. };
  84. },
  85. methods : {
  86. toHome(){
  87. if(this.length != 1){
  88. return
  89. }
  90. uni.reLaunch({
  91. url: '/pages/index/index'
  92. })
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. // .navbar{
  99. // width: 100%;
  100. // height: 120rpx;
  101. // padding-top: var(--status-bar-height);
  102. // }
  103. .title{
  104. width: 100%;
  105. height: calc(var(--status-bar-height) + 120rpx);
  106. position: sticky;
  107. top: 0;
  108. left: 0;
  109. z-index: 999;
  110. .left{
  111. position: absolute;
  112. left: 40rpx;
  113. display: flex;
  114. justify-content: flex-start;
  115. }
  116. .icon{
  117. position: absolute;
  118. right: 40rpx;
  119. display: flex;
  120. justify-content: flex-end;
  121. }
  122. }
  123. .nav {
  124. position: relative;
  125. width: 100%;
  126. height: 100%;
  127. &-bg {
  128. width: 100%;
  129. height: 100%;
  130. }
  131. &-logo {
  132. position: absolute;
  133. top: 0;
  134. right: 68rpx;
  135. width: auto;
  136. height: 100%;
  137. opacity: 0.2;
  138. }
  139. &-icon {
  140. position: absolute;
  141. bottom: 28rpx;
  142. right: 40rpx;
  143. width: 44rpx;
  144. height: auto;
  145. }
  146. }
  147. .main {
  148. position: absolute;
  149. top: 0;
  150. left: 0;
  151. display: flex;
  152. justify-content: center;
  153. font-size: 44rpx;
  154. font-weight: 700;
  155. align-items: center;
  156. padding-top: calc(var(--status-bar-height) + 20rpx);
  157. width: 100%;
  158. height: 100rpx;
  159. }
  160. .btn {
  161. &-back {
  162. &-icon {
  163. width: 46rpx;
  164. height: auto;
  165. }
  166. }
  167. }
  168. @keyframes fade-in {
  169. 0% {
  170. opacity: 0;
  171. }
  172. 100% {
  173. opacity: 1;
  174. }
  175. }
  176. </style>