imageTextNav.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div class="ul image-text-nav" :class="'terminal' + terminal">
  3. <div class="li" v-for="(item,index) in componentContent.imgTextData" :key="index" :style="{'flex':'0 0 '+ getItemValue() + '%'}" @click="jumpLink(item.linkObj)">
  4. <!--<router-link class="item" :to="jumpLink(item.linkObj)">-->
  5. <div class="img-box">
  6. <div class="img-box-inner">
  7. <div class="imgBox">
  8. <img class="img" :src="item.img"/>
  9. </div>
  10. </div>
  11. </div>
  12. <h4 class="h4">{{item.title}}</h4>
  13. <!--</router-link>-->
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import {funMixin} from '../config/mixin'
  19. export default {
  20. name: 'imageTextNav',
  21. mixins: [funMixin],
  22. props: {
  23. terminal: {
  24. type: Number,
  25. default: 4
  26. },
  27. componentContent: {
  28. type: Object
  29. }
  30. },
  31. methods: {
  32. // 计算生成格子百分比
  33. getItemValue (val) {
  34. const len = parseInt(this.componentContent.imgTextData.length)
  35. if (len === 0) {
  36. return 0
  37. } else {
  38. return (1 / len * 10000 / 100.00)
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .image-text-nav{
  46. min-height: 100upx;
  47. width: 710upx;
  48. margin: 0 auto;
  49. display: flex;
  50. padding: 20upx 0;
  51. .li{
  52. text-align: center;
  53. .img-box{
  54. .imgBox{
  55. width: 100upx;
  56. height: 100upx;
  57. display: inline-block;
  58. .img{
  59. width: 100%;
  60. height: 100%;
  61. object-fit: cover;
  62. }
  63. }
  64. }
  65. .h4{
  66. font-size: 26upx;
  67. color: #333;
  68. line-height: 33upx;
  69. }
  70. }
  71. &.terminal4{
  72. width: 1000upx;
  73. .li{
  74. .img-box{
  75. display: inline-block;
  76. width: 100upx;
  77. height: 100upx;
  78. box-shadow: 0 10upx 30upx rgba(51, 51, 51, 0.15);
  79. &-inner{
  80. display: flex;
  81. justify-content: center;
  82. align-items: center;
  83. height: 100%;
  84. }
  85. .imgBox{
  86. width: 60upx;
  87. height: 60upx;
  88. }
  89. }
  90. .h4{
  91. font-size: 18upx;
  92. color: #ccc;
  93. line-height: 1em;
  94. padding-top: 20upx;
  95. }
  96. }
  97. }
  98. }
  99. </style>