imageTextNav.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <ul class="ul image-text-nav" :class="'terminal' + terminal">
  3. <li class="li" v-for="(item,index) in componentContent.imgTextData" :key="index" :style="{'flex':'0 0 '+ getItemValue() + '%'}">
  4. <!--<router-link class="item" :to="jumpLink(item.linkObj)">-->
  5. <div class="img-box">
  6. <div class="img-box-inner">
  7. <el-image
  8. :src="item.img"
  9. fit="cover"></el-image>
  10. </div>
  11. </div>
  12. <h4 class="h4">{{item.title}}</h4>
  13. <!--</router-link>-->
  14. </li>
  15. </ul>
  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: 100px;
  47. width: 690px;
  48. margin: 0 auto;
  49. display: flex;
  50. padding: 20px 0;
  51. .li{
  52. text-align: center;
  53. .img-box{
  54. .el-image{
  55. width: 100px;
  56. height: 100px;
  57. }
  58. }
  59. .h4{
  60. font-size: 26px;
  61. color: #333;
  62. line-height: 33px;
  63. }
  64. }
  65. &.terminal4{
  66. width: 1000px;
  67. .li{
  68. .img-box{
  69. display: inline-block;
  70. width: 100px;
  71. height: 100px;
  72. border: 2px solid #F3F4F5;
  73. border-radius: 10px;
  74. &-inner{
  75. display: flex;
  76. justify-content: center;
  77. align-items: center;
  78. height: 100%;
  79. }
  80. .el-image{
  81. width: 60px;
  82. height: 60px;
  83. }
  84. }
  85. .h4{
  86. font-size: 18px;
  87. color: #ccc;
  88. line-height: 1em;
  89. padding-top: 20px;
  90. }
  91. }
  92. }
  93. }
  94. </style>