subTitleBar.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view
  3. class="subTitleBar"
  4. @click.stop="click"
  5. >
  6. <view class="left">
  7. <view class="titleLine"></view>
  8. <text class="titleText">{{ title }}</text>
  9. </view>
  10. <view
  11. v-if="showArrow"
  12. class="right"
  13. >
  14. <image
  15. v-if="isOpen"
  16. src="@/devTools/page/static/fold.png"
  17. class="arrow"
  18. />
  19. <image
  20. v-else
  21. src="@/devTools/page/static/unfold.png"
  22. class="arrow"
  23. />
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. emits: ['click'],
  30. props: {
  31. /**
  32. * 标题名称
  33. */
  34. title: {
  35. type: String,
  36. default: "标题",
  37. },
  38. /**
  39. * 是否显示右侧箭头
  40. */
  41. showArrow: {
  42. type: Boolean,
  43. default: true,
  44. },
  45. /**
  46. * 是否为开启状态
  47. */
  48. isOpen: {
  49. type: Boolean,
  50. default: false,
  51. },
  52. },
  53. data() {
  54. return {};
  55. },
  56. methods: {
  57. click(){
  58. this.$emit('click');
  59. },
  60. }
  61. };
  62. </script>
  63. <style lang="scss" scoped>
  64. .subTitleBar {
  65. display: flex;
  66. flex-direction: row;
  67. align-items: center;
  68. justify-content: space-between;
  69. padding: 20rpx 0;
  70. width: 750rpx;
  71. &:active {
  72. background-color: rgba(0, 0, 0, 0.05);
  73. }
  74. .left {
  75. display: flex;
  76. flex-direction: row;
  77. align-items: center;
  78. margin-left: 20rpx;
  79. .titleLine {
  80. width: 4rpx;
  81. height: 24rpx;
  82. border-radius: 4px;
  83. background-color: #ff2d55;
  84. }
  85. .titleText {
  86. color: #333;
  87. margin-left: 10rpx;
  88. font-size: 24rpx;
  89. line-height: 24rpx;
  90. }
  91. }
  92. .right {
  93. margin-right: 20rpx;
  94. .arrow {
  95. width: 30rpx;
  96. height: 30rpx;
  97. }
  98. }
  99. }
  100. </style>