Platform.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <script setup>
  2. import { defineProps, onMounted } from 'vue';
  3. import VanillaTilt from 'vanilla-tilt';
  4. const props = defineProps({
  5. title: String,
  6. content: String,
  7. img: String,
  8. link: String
  9. })
  10. onMounted(() => {
  11. VanillaTilt.init(document.querySelector(".platform-item"), {
  12. max: 25,
  13. speed: 400,
  14. });
  15. VanillaTilt.init(document.querySelectorAll(".platform-item"));
  16. });
  17. </script>
  18. <template>
  19. <div class="platform-item">
  20. <div class="platform-img">
  21. <img :src="img" alt="">
  22. </div>
  23. <div class="platform-content">
  24. <div class="platform-title" v-html="title">
  25. </div>
  26. <div class="platform-desc">
  27. {{ content }}
  28. </div>
  29. </div>
  30. <div class="platform-link">
  31. <a :href="link" target="_blank">点击进入</a>
  32. </div>
  33. </div>
  34. </template>
  35. <style scoped lang="scss">
  36. .platform-item {
  37. background-color: rgb(46, 62, 63);
  38. color: #fff;
  39. padding: 0px 10px 20px;
  40. min-height: 430px;
  41. width: 100%;
  42. margin-top: 50px;
  43. text-align: center;
  44. position: relative;
  45. .platform-img {
  46. text-align: center;
  47. img {
  48. width: 80%;
  49. }
  50. }
  51. .platform-content{
  52. .platform-title{
  53. font-weight: 700;
  54. font-size: 24px;
  55. margin-bottom: 20px;
  56. }
  57. .platform-desc{
  58. padding: 15px 0;
  59. font-size: 14px;
  60. }
  61. }
  62. .platform-link {
  63. a {
  64. padding: 5px 10px;
  65. background: rgb(255, 255, 255);
  66. color: rgb(46, 62, 63);
  67. font-size: 14px;
  68. border-radius: 3px;
  69. font-weight: 600;
  70. position: absolute;
  71. bottom: 25px;
  72. left: calc(50% - 38px);
  73. text-decoration: none;
  74. }
  75. }
  76. }
  77. </style>