navBar.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div
  3. :style="{
  4. height: (menuButton.height+8) + 'px',
  5. }"
  6. class="header"
  7. >
  8. <div class="header-title">
  9. <text> {{title}}</text>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. menuButton: {
  18. bottom: 0,
  19. height: 0,
  20. left: 0,
  21. right: 0,
  22. top: 0,
  23. width: 0,
  24. },
  25. };
  26. },
  27. props: {
  28. title: {
  29. type: String,
  30. default:''
  31. },
  32. size:{
  33. type:String,
  34. default:'16px'
  35. }
  36. },
  37. mounted() {
  38. this.menuButton = uni.getMenuButtonBoundingClientRect();
  39. },
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .header {
  44. width: 100%;
  45. overflow: hidden;
  46. display: flex;
  47. align-content: center;
  48. align-items: center;
  49. position: relative;
  50. background: #fff;
  51. .header-title {
  52. width: 100%;
  53. height: 100%;
  54. text-align: center;
  55. justify-content: center;
  56. vertical-align: baseline;
  57. display: flex;
  58. align-content: center;
  59. align-items: center;
  60. text {
  61. vertical-align: text-top;
  62. }
  63. }
  64. .header-left {
  65. position: absolute;
  66. left: 0;
  67. padding-left: 24rpx;
  68. height: 100%;
  69. display: flex;
  70. align-content: center;
  71. align-items: center;
  72. .arrow-left {
  73. color: #1989fa;
  74. vertical-align: middle;
  75. }
  76. }
  77. }
  78. </style>