普兆健康管家前端代码仓库
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.

146 lines
2.5 KiB

1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <!-- <view class="navbar"
  3. :style="{backgroundColor : bgColor}"> -->
  4. <view class="title nav-bar__view"
  5. :style="{backgroundColor : bgColor,color}">
  6. <view class="left">
  7. <uv-icon name="home"
  8. v-if="leftClick && length == 1"
  9. @click="toHome"
  10. :color="color" size="46rpx"></uv-icon>
  11. <uv-icon name="arrow-left"
  12. v-else-if="leftClick"
  13. @click="$emit('leftClick')"
  14. :color="color" size="46rpx"></uv-icon>
  15. </view>
  16. <view>
  17. <slot>
  18. {{ title }}
  19. </slot>
  20. </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. </template>
  43. <script>
  44. export default {
  45. name:"navbar",
  46. props : {
  47. title : {
  48. type : String,
  49. default : ''
  50. },
  51. leftClick : {
  52. type : Boolean,
  53. },
  54. moreClick : {
  55. type : Function,
  56. },
  57. isSearch : {
  58. type : Boolean,
  59. default : false,
  60. },
  61. isPlus : {
  62. type : Boolean,
  63. default : false,
  64. },
  65. moreText : {
  66. },
  67. bgColor : {
  68. default : '#fff'
  69. },
  70. color : {
  71. default : '#333'
  72. }
  73. },
  74. created() {
  75. },
  76. beforeDestroy() {
  77. },
  78. data() {
  79. return {
  80. length : getCurrentPages().length
  81. };
  82. },
  83. methods : {
  84. toHome(){
  85. if(this.length != 1){
  86. return
  87. }
  88. uni.reLaunch({
  89. url: '/pages/index/index'
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. // .navbar{
  97. // width: 100%;
  98. // height: 120rpx;
  99. // padding-top: var(--status-bar-height);
  100. // }
  101. .title{
  102. position: sticky;
  103. top: 0;
  104. left: 0;
  105. padding-top: calc(var(--status-bar-height) + 20rpx);
  106. width: 100%;
  107. height: $navbar-height;
  108. background-color: #fff;
  109. display: flex;
  110. justify-content: center;
  111. font-size: 32rpx;
  112. align-items: center;
  113. z-index: 999;
  114. .left{
  115. position: absolute;
  116. left: 40rpx;
  117. display: flex;
  118. justify-content: flex-start;
  119. }
  120. .icon{
  121. position: absolute;
  122. right: 40rpx;
  123. display: flex;
  124. justify-content: flex-end;
  125. }
  126. }
  127. @keyframes fade-in {
  128. 0% {
  129. opacity: 0;
  130. }
  131. 100% {
  132. opacity: 1;
  133. }
  134. }
  135. </style>