小说小程序前端代码仓库(小程序)
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.

150 lines
2.6 KiB

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