hexagonBlock.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div class="hexagon-container">
  3. <i class="icon iconfont" v-html="icon"></i>
  4. <p class="content" v-html="content"></p>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name: "hexagonBlock",
  10. props:['icon','content']
  11. }
  12. </script>
  13. <style scoped lang="less">
  14. @import "../assets/less/_variable.less";
  15. @hexagonColor:white;
  16. @hexagonHeight:100px;
  17. .hexagon-container {
  18. width:45px;
  19. height:100px;
  20. background: white;
  21. display: inline-block;
  22. position: relative;
  23. line-height: @hexagonHeight;
  24. color:#FFFFFF;
  25. font-size: 20px;
  26. margin-bottom: 135px;
  27. text-align: center;
  28. & .content{
  29. position: absolute;
  30. height: 20px;
  31. font-size: 20px;
  32. line-height: 20px;
  33. color:@lightBlack;
  34. left: 50%;
  35. white-space:nowrap;
  36. transform: translateX(-50%);
  37. }
  38. &:hover{
  39. &:before{
  40. border-right-color: @primaryBlue;
  41. }
  42. background-color: @primaryBlue;
  43. &:after{
  44. border-left-color: @primaryBlue;
  45. }
  46. & .icon{
  47. color: white;
  48. }
  49. }
  50. & .icon{
  51. font-size: 54px;
  52. color:@primaryBlue;
  53. }
  54. &:before{
  55. content:"";
  56. width:0px;
  57. border-bottom: @hexagonHeight/2 solid transparent;
  58. border-top:@hexagonHeight/2 solid transparent;
  59. border-right:40px solid white;
  60. position:absolute;
  61. left:-40px;
  62. top:0px;
  63. }
  64. &:after{
  65. content:"";
  66. width:0px;
  67. border-bottom:@hexagonHeight/2 solid transparent;
  68. border-top:@hexagonHeight/2 solid transparent;
  69. border-left-width:40px;
  70. border-left-style: solid;
  71. border-left-color:white;
  72. position:absolute;
  73. right:-40px;
  74. top:0px;
  75. }
  76. }
  77. </style>