index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="m-title-box">
  3. <text class="m-title" :style="getTitleStyle">{{title}}</text>
  4. <view class="m-title-end-box" @click="commit">
  5. <text class="m-subTitle" :style="getSubTitleStyle">{{subTitle}}</text>
  6. <image v-show="showRow" class="m-title-row" src="/static/ic_login_right_row.svg" mode="widthFix">
  7. </image>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. // 通用title
  14. name: "m-title",
  15. props: {
  16. color: {
  17. type: String,
  18. default: "#333333"
  19. },
  20. fontWeight: {
  21. type: String,
  22. default: "500"
  23. },
  24. height: {
  25. type: String,
  26. default: "auto"
  27. },
  28. titleSize: {
  29. type: String,
  30. default: "28rpx"
  31. },
  32. subTitleSize: {
  33. type: String,
  34. default: "28rpx"
  35. },
  36. title: {
  37. type: String,
  38. default: ""
  39. },
  40. subTitle: {
  41. type: String,
  42. default: ""
  43. },
  44. showRow: {
  45. type: Boolean,
  46. default: true
  47. },
  48. },
  49. computed: {
  50. getTitleStyle() {
  51. return "height:" + this.height + ";color:" + this.color + ";font-weight:" + this.fontWeight +
  52. ";font-size:" + this.titleSize + ";"
  53. },
  54. getSubTitleStyle() {
  55. return "font-size:" + this.subTitleSize + ";"
  56. },
  57. },
  58. data() {
  59. return {
  60. };
  61. },
  62. methods: {
  63. commit(index) {
  64. this.$emit("click", index)
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .m-title-box {
  71. width: 100%;
  72. height: 100%;
  73. display: flex;
  74. flex-direction: row;
  75. align-items: center;
  76. }
  77. .m-title {
  78. font-family: 'PingFang SC';
  79. font-style: normal;
  80. line-height: 20px;
  81. display: flex;
  82. align-items: center;
  83. text-align: center;
  84. letter-spacing: 0.02em;
  85. white-space: nowrap;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. }
  89. .m-title-end-box {
  90. flex: 1;
  91. height: 100%;
  92. display: flex;
  93. align-items: center;
  94. flex-direction: row;
  95. justify-content: flex-end;
  96. }
  97. .m-subTitle {
  98. font-family: 'PingFang SC';
  99. font-style: normal;
  100. font-weight: 400;
  101. text-align: right;
  102. letter-spacing: 0.02em;
  103. color: #999999;
  104. white-space: nowrap;
  105. overflow: hidden;
  106. text-overflow: ellipsis;
  107. }
  108. .m-title-row {
  109. width: 32rpx;
  110. height: 32rpx;
  111. }
  112. </style>