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

147 lines
2.6 KiB

2 months ago
2 months ago
2 months ago
  1. <template>
  2. <!-- <view class="navbar"
  3. :style="{backgroundColor : bgColor}"> -->
  4. <view class="title"
  5. :style="{backgroundColor : bgColor,color,
  6. position
  7. }">
  8. <view class="left">
  9. <uv-icon name="home"
  10. v-if="leftClick && length == 1"
  11. @click="toHome"
  12. :color="color" size="46rpx"></uv-icon>
  13. <uv-icon name="arrow-left"
  14. v-else-if="leftClick"
  15. @click="$emit('leftClick')"
  16. :color="color" size="46rpx"></uv-icon>
  17. </view>
  18. <view>{{ title }}</view>
  19. <view class="icon">
  20. <uv-icon name="search"
  21. v-if="isSearch"
  22. :color="color" size="58rpx"></uv-icon>
  23. <uv-icon name="plus-circle" :color="color"
  24. v-if="isPlus"
  25. @click="plusCircleShow = true"
  26. size="46rpx" style="margin-left: 30rpx;"></uv-icon>
  27. <view v-if="moreClick" style="margin-left: 30rpx;">
  28. <uv-icon name="more-dot-fill" :color="color"
  29. v-if="!moreText"
  30. @click="moreClick()"
  31. size="46rpx"></uv-icon>
  32. <view v-else @click="moreClick"
  33. style="font-weight: 400;font-size: 30rpx;">
  34. {{ moreText }}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  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. position : {
  72. type : String,
  73. default : 'sticky'
  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. top: 0;
  105. left: 0;
  106. padding-top: calc(var(--status-bar-height) + 20rpx);
  107. width: 100%;
  108. height: 100rpx;
  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>