index.vue 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="square">
  3. <view class="content">
  4. <view class="box">
  5. <image :src="icon" mode="aspectFit" class="icon"></image>
  6. <text class='font'>{{title}}</text>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. props: {
  14. icon: String,
  15. title: String
  16. },
  17. data() {
  18. return {}
  19. },
  20. methods: {
  21. }
  22. }
  23. </script>
  24. <style lang="scss" scoped>
  25. .square {
  26. padding: 10rpx;
  27. }
  28. .content {
  29. width: 100%;
  30. padding-bottom: 100%;
  31. background-color: #FFFFFF;
  32. position: relative;
  33. border-radius: 10rpx;
  34. overflow: hidden;
  35. .box {
  36. position: absolute;
  37. left: 50%;
  38. top: 50%;
  39. transform: translate(-50%, -50%);
  40. display: flex;
  41. flex-direction: column;
  42. justify-content: space-between;
  43. align-items: center;
  44. width: 100%;
  45. height: 100%;
  46. .icon {
  47. flex: 1;
  48. }
  49. .font {
  50. font-size: 26rpx;
  51. font-family: PingFang SC;
  52. font-weight: 400;
  53. color: #0F0404;
  54. margin-top: -0.5em;
  55. margin-bottom: 0.5em;
  56. }
  57. }
  58. }
  59. </style>