123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <div class="mta-card-lv1">
- <div class="mta-card-content-pc mta-hidden-xs" :class="[img.order>contentOrder ? 'img-left': 'img-right']">
- <img :style="`order:${img.order}`" :src="img.url">
- <div class="card-info" :style="`order: ${contentOrder}`">
- <h5>{{title}}</h5>
- <p class="card-des">{{description}}</p>
- <div class="mta-card-row" v-for="(rowList,index) in tagesPc" :key="`pc-${index}`">
- <template v-for="(des,ind) in rowList">
- <!-- 站位div -->
- <span v-if="des.empty" :key="ind"></span>
- <span v-else class="mta-card-row-item" :key="ind"><i></i><span>{{des.value}}</span></span>
- </template>
- </div>
- </div>s
- </div>
- <div class="mta-card-content-h5 mta-hidden-sm">
- <img :src="img">
- <div class="card-info">
- <h5>{{title}}</h5>
- <p>{{description}}</p>
- <div class="mta-card-row" v-for="(rowList,index) in tagesH5" :key="`pc-${index}`">
- <template v-for="(des,ind) in rowList">
- <!-- 站位div -->
- <span v-if="des.empty" :key="ind"></span>
- <span :key="ind"><i></i><span>{{des.value}}</span></span>
- </template>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "imgCardLv1",
- props: {
- option: {
- type: Object,
- required: true,
- },
- colPc: {
- type: Number,
- default: 3
- },
- colH5: {
- type: Number,
- default: 3
- }
- },
- computed: {
- img() {
- return {url: this.option.img.url, order: this.option.img.order}
- },
- title() {
- return this.option.content.title;
- },
- description() {
- return this.option.content.des;
- },
- contentOrder() {
- return this.option.content.order;
- },
- tagesPc() {
- const count = this.colPc;
- const list = this.option.content.list;
- const row = Math.ceil(list.length / count);
- const result = [];
- for (let i = 1; i <= row; i++) {
- const start = (i - 1) * count;
- const end = (i * count)
- const curList = list.slice(start, end);
- if (curList.length < count) {
- curList.push({type: 'empty'});
- }
- result.push(curList)
- }
- return result;
- },
- tagesH5() {
- const count = this.colH5;
- const list = this.option.content.list;
- const row = Math.ceil(list.length / count);
- const result = [];
- for (let i = 1; i <= row; i++) {
- const start = (i - 1) * count;
- const end = (i * count)
- const curList = list.slice(start, end);
- if (curList.length < count) {
- curList.push({type: 'empty'});
- }
- result.push(curList)
- }
- return result;
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .mta-card-lv1 {
- .mta-card-content-pc {
- display: flex;
- }
- .img-left {
- img {
- margin-left: 100px;
- }
- }
- .img-right {
- img {
- margin-right: 100px;
- }
- }
- .card-info {
- h5 {
- font-size: 24px;
- font-weight: 800;
- text-align: left;
- color: #333;
- margin-top: 40px;
- margin-bottom: 30px;
- }
- .card-des {
- font-size: 14px;
- color: #333;
- font-weight: 500;
- text-align: left;
- }
- }
- .mta-card-row-item {
- font-size: 14px;
- font-weight: 500;
- color: #333;
- i {
- display: inline-block;
- width:13px;
- height: 13px;
- background: #00b96b;
- margin-right: 13px;
- }
- }
- }
- </style>
|