my-topbar.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 class="mcName">{{mcName}}</text>
  8. <view class="topbar-left-right uni-row uni-jce">
  9. <uni-icons v-if="showMessage" type="notification-filled" class="topbar-ico topbar-ico-message" @click="btnMessage"></uni-icons>
  10. <text class="topbar-rule" @click="btnInfo">规则</text>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name:"my-topbar",
  17. props: {
  18. mcName: {
  19. type: String,
  20. default: ""
  21. },
  22. showMessage: {
  23. type: Boolean,
  24. default: false
  25. // default: true
  26. }
  27. },
  28. emits: ['btnBackClick', 'btnInfoClick', 'btnMessageClick'],
  29. data() {
  30. return {
  31. };
  32. },
  33. methods: {
  34. btnBack() {
  35. this.$emit('btnBackClick');
  36. },
  37. btnInfo() {
  38. this.$emit('btnInfoClick');
  39. },
  40. btnMessage() {
  41. this.$emit('btnMessageClick');
  42. }
  43. }
  44. }
  45. </script>
  46. <style>
  47. .topbar {
  48. width: 92%;
  49. /* padding-top: 2px; */
  50. justify-content: space-between;
  51. }
  52. .topbar-color-default {
  53. color: #5b9100;
  54. }
  55. .topbar-left-right {
  56. /* width: 128rpx; */
  57. /* background-color: dimgray; */
  58. }
  59. .topbar-ico { width: 43rpx; height: 43rpx;
  60. /* padding: 0 10rpx; */ color: inherit !important; font-size: 46rpx !important; }
  61. .topbar-ico-back {
  62. padding-right: 10rpx;
  63. }
  64. .topbar-ico-message {
  65. padding-left: 10rpx;
  66. }
  67. .topbar-rule {
  68. /* width: 60rpx; */
  69. padding: 0 10rpx;
  70. font-size: 30rpx;
  71. white-space: nowrap;
  72. }
  73. .mcName {
  74. /* padding: 0 10rpx; */
  75. font-size: 36rpx;
  76. font-weight: 550;
  77. white-space: nowrap;
  78. overflow: hidden;
  79. /* text-overflow: ellipsis; */
  80. }
  81. </style>