工单小程序2024-11-20
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.

139 lines
2.4 KiB

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