敢为人鲜小程序前端代码仓库
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.

142 lines
2.4 KiB

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