健康同学微信公众号h5项目
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

117 行
2.6KB

  1. <!-- -->
  2. <template>
  3. <div class="submenu-list">
  4. <div class="header">
  5. <div class="left">
  6. <p>{{ title }}</p>
  7. </div>
  8. <div class="right"></div>
  9. </div>
  10. <div class="main">
  11. <div class="list">
  12. <div class="item" v-for="(item, index) in list" :key="index" @click="onItemClick(item)">
  13. <div class="img-icon-con" :style="{ borderRadius: rounded ? '50%' : '8px', backgroundColor: item.bgColor }">
  14. <img :src="item.imgPath" alt="" />
  15. </div>
  16. <div class="text">
  17. <span>{{ item.text }}</span>
  18. </div>
  19. </div>
  20. <slot name="addDevice"></slot>
  21. </div>
  22. </div>
  23. <!-- <div class="footer"></div> -->
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'SubmenuList',
  29. props: {
  30. title: {
  31. type: String,
  32. default: ''
  33. },
  34. list: {
  35. type: Array,
  36. default: '' || []
  37. },
  38. rounded: {
  39. type: Boolean,
  40. default: null || false
  41. }
  42. },
  43. data() {
  44. return {};
  45. },
  46. created() {},
  47. mounted() {},
  48. methods: {
  49. onItemClick(item) {
  50. console.log('点击的item', item);
  51. if (item.showType) {
  52. if (item.showType === 'newPage') {
  53. this.$router.push({
  54. name: `${item.routerName}`
  55. });
  56. }
  57. }
  58. }
  59. }
  60. };
  61. </script>
  62. <style scoped lang="scss">
  63. .submenu-list {
  64. height: 100%;
  65. width: 100%;
  66. position: relative;
  67. .header {
  68. position: relative;
  69. font-weight: bold;
  70. padding: 10px 20px;
  71. @include flexbox(flex-start, center, row, wrap);
  72. .left {
  73. p {
  74. font-size: 42px;
  75. }
  76. }
  77. }
  78. .main {
  79. position: relative;
  80. @include flexbox(flex-start, center, row, wrap);
  81. width: 100%;
  82. .list {
  83. position: relative;
  84. padding-left: 20px;
  85. /* @include flexbox(flex-start, flex-start, row, wrap); */
  86. display: grid;
  87. grid-template-columns: repeat(4, auto);
  88. grid-gap: 40px;
  89. /* grid-template-rows: auto auto; */
  90. .item {
  91. position: relative;
  92. /* height: 140px; */
  93. /* max-width: 180px; */
  94. /* padding: 0 20px; */
  95. @include flexbox(center, center, column, nowrap);
  96. .img-icon-con {
  97. padding: 20px;
  98. @include flexbox(space-around, center, column, wrap);
  99. img {
  100. height: 80px;
  101. widows: 80px;
  102. }
  103. }
  104. .text {
  105. @include flexbox(flex-start, center, column, wrap);
  106. padding: 5px;
  107. font-size: 28px;
  108. font-weight: 400;
  109. }
  110. }
  111. }
  112. }
  113. }
  114. /* @import url(); 引入css类 */
  115. </style>