Nav.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="nav-moudle" :class="{'bottom-border':border}" :style="{'background-color':backColor}">
  3. <view class="left-button button" @click="leftClick">
  4. <slot name="left" v-if="leftShow">
  5. <image :src="imgurl" class="icon-left">
  6. </image>
  7. </slot>
  8. </view>
  9. <view class="title-text" :style="{'color':titleColor}">
  10. {{title}}
  11. </view>
  12. <view class="right-button button" @click="rightClick">
  13. <slot name="right" v-if="rightShow">
  14. <image src="../../static/tabBar/business.png" class="icon-right"></image>
  15. </slot>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. props: {
  22. title: {
  23. type: String,
  24. default: '标题'
  25. },
  26. titleColor: {
  27. type: String,
  28. default: '#333'
  29. },
  30. backColor: {
  31. type: String,
  32. default: '#fff'
  33. },
  34. leftShow: {
  35. type: Boolean,
  36. default: true
  37. },
  38. rightShow: {
  39. type: Boolean,
  40. default: false
  41. },
  42. border: {
  43. type: Boolean,
  44. default: true
  45. },
  46. imgurl: {
  47. type: String,
  48. default: require('../../static/home/retreat.png')
  49. }
  50. },
  51. methods: {
  52. leftClick() {
  53. this.$emit('leftClick')
  54. },
  55. rightClick() {
  56. this.$emit('rightClick')
  57. },
  58. },
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. .nav-moudle {
  63. display: flex;
  64. align-items: center;
  65. padding: 0 12px 0 12px;
  66. height: 44px;
  67. .title-text {
  68. flex: 1;
  69. text-align: center;
  70. font-size: 17px;
  71. font-weight: 600;
  72. }
  73. .icon-left {
  74. width: 20px;
  75. height: 20px;
  76. }
  77. }
  78. .button {
  79. width: 21px;
  80. }
  81. </style>