移动端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

113 řádky
2.3 KiB

  1. <template>
  2. <div>
  3. <div
  4. :class='[background == "1"?"nav-wrap":"nav-wrap1",positionType=="fixed"?"nav-position-fixed":"nav-position-relative"]'
  5. :style='{"height": 50+"px","overflow": "hidden","background":backgroundColor}'
  6. >
  7. <!-- // 导航栏 中间的标题 -->
  8. <div class='nav-title' :style='{"line-height": 50+"px"}'>{{title}}</div>
  9. <div style='display: flex; justify-content: center;flex-direction: column;height: 50px;padding-left: 2%;'>
  10. <!-- // 其中wx:if='{{navbarData.showCapsule}}' 是控制左上角按钮的显示隐藏,首页不显示 -->
  11. <van-icon name="arrow-left" color="#333333" size="25" @click="onClickLeft()" />
  12. </div>
  13. </div>
  14. <div :style='{"height": 50+"px"}' v-if="positionType == 'fixed'"></div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. name: "nav_bar",
  20. props: [
  21. "background",
  22. "backgroundColor",
  23. "positionType",
  24. "showCapsule",
  25. "title",
  26. ],
  27. data() {
  28. return {
  29. height: '',
  30. navHeight:'',
  31. }
  32. },
  33. created() {
  34. },
  35. methods: {
  36. },
  37. }
  38. </script>
  39. <style scoped lang="scss">
  40. .nav-wrap {
  41. width: 100%;
  42. top: 0;
  43. background: transparent;
  44. color: #000;
  45. z-index: 9999999;
  46. }
  47. .nav-wrap1 {
  48. width: 100%;
  49. top: 0;
  50. background: linear-gradient(to bottom right,#91E1CA,#E0F4E4);
  51. color: #333333;
  52. z-index: 9999999;
  53. }
  54. /* 标题要居中 */
  55. .nav-title {
  56. position: absolute;
  57. text-align: center;
  58. max-width: 200px;
  59. overflow: hidden;
  60. text-overflow: ellipsis;
  61. white-space: nowrap;
  62. top: 0;
  63. left: 0;
  64. right: 0;
  65. bottom: 0;
  66. margin: auto;
  67. font-size: 16Px;
  68. }
  69. .nav-capsule {
  70. display: flex;
  71. align-items: center;
  72. margin-left: 5px;
  73. width: 70px;
  74. justify-content: space-between;
  75. height: 100%;
  76. }
  77. .navbar-v-line {
  78. width: 1px;
  79. height: 16px;
  80. background-color: #e5e5e5;
  81. }
  82. /*.back-pre,*/
  83. /*.back-home {*/
  84. /* width: 18Px;*/
  85. /* height: 25Px;*/
  86. /* margin-top: 2px;*/
  87. /* padding: 5px;*/
  88. /* border-radius: 50%;*/
  89. /*}*/
  90. .nav-capsule .back-home {
  91. width: 30px;
  92. height: 30px;
  93. margin-top: 1.5px;
  94. }
  95. .nav-position-fixed{
  96. position: fixed;
  97. }
  98. .nav-position-relative{
  99. position: relative;
  100. }
  101. </style>