123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <div class="category-list warp" :class="'terminal' + terminal">
- <h2 class="hom-title" :style="{textAlign:componentContent.textAlign}">{{componentContent.title}}</h2>
- <div class="content-warp">
- <ul class="clearfix" :class="{number5: componentContent.categoryData.length === 5}">
- <li v-for="(item) of componentContent.categoryData" :key="item.id">
- <a class="item a-link" @click="jumpCategory(item)">
- <div class="imgBox">
- <img ref="getHeight" :src="item.img" v-show="item.img" :alt="item.name">
- </div>
- </a>
- </li>
- </ul>
- </div>
- </div>
- </template>
- <script>
- import {funMixin} from '../config/mixin'
- export default {
- name: 'categoryList',
- mixins: [funMixin],
- props: {
- terminal: {
- type: Number,
- default: 4
- },
- componentContent: {
- type: Object
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .category-list{
- padding: 20px 0;
- .hom-title{
- font-size: 22px;
- color: #333;
- line-height: 1em;
- margin-bottom: 23px;
- font-weight: bold;
- text-align: center;
- }
- .content-warp{
- display: flex;
- ul{
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- li{
- flex: 1;
- padding: 10px 0 0 10px;
- .item{
- height: auto;
- display: flex;
- flex-direction: column;
- justify-content: center;
- .imgBox {
- padding-bottom: 80%;
- background-color: #cacaca;
- position: relative;
- }
- img {
- max-width: 100%;
- height: 100%;
- max-height: 100%;
- position: absolute;
- margin: auto;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- }
- }
- }
- }
- .number5 {
- display: block;
- li {
- width: 25%;
- float: left;
- }
- li:nth-child(1) {
- width: 50%;
- }
- }
- }
- }
- @media screen and (max-width: 768px) {
- .category-list .content-warp{
- display: block;
- ul{
- margin: -15px 0 0 -15px;
- width: auto;
- li{
- flex: 0 0 50%;
- padding: 15px 0 0 15px;
- }
- }
- }
- }
- .terminal1,.terminal2,.terminal3{
- &.category-list .content-warp{
- display: block;
- ul{
- margin: -15px 0 0 -15px;
- width: auto;
- li{
- flex: 0 0 50%;
- padding: 15px 0 0 15px;
- }
- }
- }
- }
- </style>
|