DemoHomeNav.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="demo-home-nav">
  3. <view class="demo-home-nav__title">{{ group.groupName }}</view>
  4. <view class="demo-home-nav__group">
  5. <view v-for="(item, index) in group.list" :key="index" class="demo-home-nav__block" @click="onClick(item.path)">
  6. <!-- <image class="image" :src="item.image"></image> -->
  7. <view class="block-card">
  8. <view class="block-card-icon">
  9. <view :class="[
  10. 'iconfont',
  11. 'card-icon-content',
  12. 'zebra-icon-' + item.image,
  13. ]" />
  14. <view class="block-card-title">
  15. {{ item.title.split(" ")[1] }}
  16. </view>
  17. <view class="block-card-text">
  18. {{ item.title.split(" ")[0] }}
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. props: {
  29. group: {
  30. type: Object,
  31. default: function() {
  32. return null;
  33. },
  34. },
  35. },
  36. methods: {
  37. onClick(event) {
  38. const url = `/pages${event}/index`;
  39. if (getCurrentPages().length > 9) {
  40. uni.redirectTo({
  41. url,
  42. });
  43. } else {
  44. uni.navigateTo({
  45. url,
  46. });
  47. }
  48. },
  49. },
  50. };
  51. </script>
  52. <style scoped lang="scss">
  53. @import "@/common/style/icon.css";
  54. .card-icon-content {
  55. color: #1874ca;
  56. font-size: 78rpx;
  57. }
  58. .demo-home-nav__title {
  59. margin: 0 32rpx;
  60. color: rgba(69, 90, 100, 0.6);
  61. font-size: 14px;
  62. }
  63. .demo-home-nav__group {
  64. display: flex;
  65. flex-wrap: wrap;
  66. padding: 20rpx 0;
  67. }
  68. .demo-home-nav__block {
  69. width: 330rpx;
  70. height: 300rpx;
  71. display: flex;
  72. align-items: center;
  73. justify-content: center;
  74. .block-card {
  75. width: 240rpx;
  76. height: 240rpx;
  77. box-shadow: 12rpx 12rpx 24rpx #bec8e4, -12rpx -12rpx 24rpx #fff;
  78. border-radius: 26rpx;
  79. background-color: #e4ebf5;
  80. box-sizing: border-box;
  81. padding: 30rpx;
  82. .block-card-title {
  83. margin-top: 20rpx;
  84. font-weight: bold;
  85. font-size: 36rpx;
  86. color: #1874ca;
  87. }
  88. .block-card-text {
  89. margin-top: 14rpx;
  90. font-size: 22rpx;
  91. color: rgba(69, 90, 100, 0.6);
  92. }
  93. }
  94. }
  95. </style>