title-operate.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="slot" :style="{ padding, backgroundColor, alignItems: align }">
  3. <view class="name" :style="[{ fontSize: titleSize }, titleColor ? { color: titleColor } : {}]">{{ title }}</view>
  4. <view class="more" v-if="showMore" @click="clickMore">
  5. {{ moreLabel ? moreLabel : '' }}
  6. <u-icon size="30" name="arrow-right"></u-icon>
  7. </view>
  8. <!-- 自定义右侧占位 -->
  9. <view class="more" v-else><slot></slot></view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'title-operate',
  15. props: {
  16. // 标题
  17. title: {
  18. type: String,
  19. default: '标题'
  20. },
  21. // 显示更多
  22. showMore: {
  23. type: Boolean,
  24. default: false
  25. },
  26. // 更多按钮的名称
  27. moreLabel: {
  28. type: String,
  29. default: ''
  30. },
  31. // 内边距
  32. padding: {
  33. type: String,
  34. default: '30rpx'
  35. },
  36. // 背景
  37. backgroundColor: {
  38. type: String,
  39. default: ''
  40. },
  41. // 标题字体大小
  42. titleSize: {
  43. type: String,
  44. default: '34rpx'
  45. },
  46. // 对齐方式
  47. align: {
  48. type: String,
  49. default: 'flex-end'
  50. },
  51. // 标题颜色
  52. titleColor: {
  53. type: String,
  54. default: ''
  55. }
  56. },
  57. methods: {
  58. clickMore() {
  59. console.log('1111'),
  60. this.$emit('clickMore');
  61. }
  62. }
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. .slot {
  67. display: flex;
  68. justify-content: space-between;
  69. .name {
  70. color: $app-theme-text-black-color;
  71. }
  72. .more {
  73. display: flex;
  74. align-items: center;
  75. color: $app-theme-text-gray-color;
  76. }
  77. }
  78. </style>