diy-center-menu.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template id="diy-center-menu">
  2. <div class="diy-center-box" :style="{background: bottomBg}">
  3. <div class="diy-center-list" :style="[computedStyle.searchIpts]">
  4. <div class="diy-center-cell" flex="cross:center" :style="{background: titleBg}" v-if="title">
  5. <div class="cell-title" :style="{color: titleColor}">{{ title }}</div>
  6. <div class="cell-subtitle" :style="{color: subtitleColor}" v-if="subTitle">{{ subTitle }}</div>
  7. <i v-if="icon" :class="icon" :style="{color: subtitleColor, fontSize: iconSize + 'px'}" style="margin-top: 2px;"></i>
  8. </div>
  9. <div class="diy-center-menu-box" flex="cross:center wrap:wrap" :style="{background: contentBg}">
  10. <div class="order-menu-items" :style="{width: itemWidth}" v-for="(item, index) in list" :key="index">
  11. <el-image class="order-menu-img" :style="{maxWidth: widthImg + 'px', height: heightImg + 'px'}" :src="item.img"></el-image>
  12. <div class="order-menu-text" :style="{color: btnColor}">{{ item.btnText }}</div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. Vue.component('diy-center-menu', {
  20. name: "diy-center-menu",
  21. template: "#diy-center-menu",
  22. props: {
  23. activeItem: {
  24. type: Object,
  25. default () {
  26. return {}
  27. }
  28. },
  29. list: { // 列表
  30. type: Array,
  31. default: () => []
  32. },
  33. title: { // 标题
  34. type: String,
  35. default: ''
  36. },
  37. subTitle: { // 副标题
  38. type: String,
  39. default: ''
  40. },
  41. icon: { // 图标
  42. type: String,
  43. default: ''
  44. },
  45. iconSize: { // 图标的大小
  46. type: Number,
  47. default: 12
  48. },
  49. bottomBg: { // 底部背景
  50. type: String,
  51. default: ''
  52. },
  53. titleBg: { // 标题背景
  54. type: String,
  55. default: ''
  56. },
  57. contentBg: { // 内容背景
  58. type: String,
  59. default: ''
  60. },
  61. titleColor: { // 标题颜色
  62. type: String,
  63. default: ''
  64. },
  65. subtitleColor: { // 副标题颜色
  66. type: String,
  67. default: ''
  68. },
  69. btnColor: { // 按钮
  70. type: String,
  71. default: ''
  72. },
  73. widthImg: { // 图片的宽度
  74. type: Number,
  75. default: 30
  76. },
  77. heightImg: { // 图片的高度
  78. type: Number,
  79. default: 25
  80. },
  81. itemWidth: { // 按钮的宽度
  82. type: String,
  83. default: '20%'
  84. },
  85. },
  86. computed: {
  87. computedStyle() {
  88. return this.activeItem.computedStyle
  89. }
  90. },
  91. data() {
  92. return {
  93. }
  94. },
  95. methods: {
  96. }
  97. });
  98. </script>
  99. <style>
  100. .diy-center-box,
  101. .diy-center-list {
  102. position: relative;
  103. overflow: hidden;
  104. }
  105. .diy-center-cell {
  106. padding: 0 10px;
  107. align-items: center;
  108. background: #fff;
  109. height: 50px;
  110. font-size: 14px;
  111. }
  112. .cell-title {
  113. font-size: 15px;
  114. font-weight: 700;
  115. }
  116. .cell-subtitle {
  117. flex: 1;
  118. text-align: right;
  119. font-size: 13px;
  120. color: #999ca7;
  121. }
  122. .diy-center-menu-box {
  123. padding: 10px 0;
  124. text-align: center;
  125. background: #fff;
  126. }
  127. .order-menu-items {
  128. padding: 5px 0;
  129. }
  130. .order-menu-img {
  131. max-width: 30px;
  132. height: 25px;
  133. }
  134. .order-menu-text {
  135. font-size: 12px;
  136. padding-top: 4px;
  137. color: #666666;
  138. }
  139. </style>