my-topbar.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="topbar uni-row">
  3. <view class="topbar-left-right uni-row uni-jct">
  4. <uni-icons type="left" class="topbar-ico topbar-ico-back" @click="btnBack"></uni-icons>
  5. <text v-if="showMessage" class="topbar-rule"></text>
  6. </view>
  7. <text v-if="mcName.length > 0" class="mcName" v-html="mcName"></text>
  8. <text v-if="exchangeTitle.length > 0" class="exchangeTitle" v-html="exchangeTitle"></text>
  9. <view class="topbar-left-right uni-row uni-jce">
  10. <uni-icons v-if="showMessage" type="notification-filled" class="topbar-ico topbar-ico-message" @click="btnMessage"></uni-icons>
  11. <text v-if="showRule" class="topbar-rule" @click="btnInfo" v-html="ruleLable"></text>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name:"my-topbar",
  18. props: {
  19. mcName: {
  20. type: String,
  21. default: ""
  22. },
  23. exchangeTitle: {
  24. type: String,
  25. default: ""
  26. },
  27. ruleLable: {
  28. type: String,
  29. default: "说明"
  30. },
  31. showMessage: {
  32. type: Boolean,
  33. default: false
  34. // default: true
  35. },
  36. showRule: {
  37. type: Boolean,
  38. default: true
  39. // default: true
  40. }
  41. },
  42. emits: ['btnBackClick', 'btnInfoClick', 'btnMessageClick'],
  43. data() {
  44. return {
  45. };
  46. },
  47. methods: {
  48. btnBack() {
  49. this.$emit('btnBackClick');
  50. },
  51. btnInfo() {
  52. this.$emit('btnInfoClick');
  53. },
  54. btnMessage() {
  55. this.$emit('btnMessageClick');
  56. }
  57. }
  58. }
  59. </script>
  60. <style>
  61. .topbar {
  62. width: 92%;
  63. /* padding-top: 2px; */
  64. justify-content: space-between;
  65. }
  66. .topbar-color-default {
  67. color: #5b9100;
  68. }
  69. .topbar-left-right {
  70. min-width: 50px;
  71. max-width: 128rpx;
  72. /* background-color: dimgray; */
  73. }
  74. .topbar-ico { width: 43rpx; height: 43rpx;
  75. /* padding: 0 10rpx; */ color: inherit !important; font-size: 46rpx !important; }
  76. .topbar-ico-back {
  77. padding-right: 10rpx;
  78. }
  79. .topbar-ico-message {
  80. padding-left: 10rpx;
  81. }
  82. .topbar-rule {
  83. /* width: 60rpx; */
  84. padding: 0 10rpx;
  85. font-size: 30rpx;
  86. white-space: nowrap;
  87. }
  88. .mcName {
  89. /* padding: 0 10rpx; */
  90. /* width: 80%; */
  91. font-size: 36rpx;
  92. font-weight: 550;
  93. white-space: nowrap;
  94. overflow: hidden;
  95. /* text-overflow: ellipsis; */
  96. }
  97. .exchangeTitle {
  98. font-size: 22px;
  99. font-weight: 550;
  100. color: #A65600;
  101. white-space: nowrap;
  102. overflow: hidden;
  103. }
  104. </style>