推拿小程序前端代码仓库
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.

151 lines
2.6 KiB

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