| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <div class="main-box main-left-right-box row">
- <div class="col col-12 col-lg-6 col-md-6">
- <template v-if="left">
- <Carousel v-if="rightItems && rightItems.length > 0" v-bind="carousel2Config" class="carousel-light h-100">
- <Slide
- v-for="(item, index) in rightItems"
- :key="index"
- @click="() => item.link ? undefined : emit('rightItemDefaultClick', item)"
- >
- <NuxtLink v-if="item.link" :to="item.link" class="w-100 h-100">
- <ImageTitleBlock fit
- :image="item.image"
- :title="item.title"
- :desc="item.desc"
- />
- </NuxtLink>
- <ImageTitleBlock v-else fit
- :image="item.image"
- :title="item.title"
- :desc="item.desc"
- />
- </Slide>
- <template #addons>
- <Navigation />
- <Pagination />
- </template>
- </Carousel>
- <img v-else :src="image" alt="image" class="h-100" @click="emit('moreClick')" />
- </template>
- <TitleDescBlock
- v-else
- :title="title"
- :desc="desc"
- :descLines="descLines"
- :showExpand="showExpand"
- :more="showMore"
- :moreLink="moreLink"
- @moreClick="emit('moreClick')"
- />
- </div>
- <div class="col col-12 col-lg-6 col-md-6">
- <TitleDescBlock
- v-if="left"
- :title="title"
- :desc="desc"
- :descLines="descLines"
- :showExpand="showExpand"
- :more="showMore"
- :moreLink="moreLink"
- @moreClick="emit('moreClick')"
- />
- <template v-else>
- <Carousel v-if="rightItems && rightItems.length > 0" v-bind="carousel2Config" class="carousel-light h-100">
- <Slide
- v-for="(item, index) in rightItems"
- :key="index"
- @click="() => item.link ? undefined : emit('rightItemDefaultClick', item)"
- >
- <NuxtLink v-if="item.link" :to="item.link" class="w-100 h-100">
- <ImageTitleBlock fit
- :image="item.image"
- :title="item.title"
- :desc="item.desc"
- />
- </NuxtLink>
- <ImageTitleBlock v-else fit
- :image="item.image"
- :title="item.title"
- :desc="item.desc"
- />
- </Slide>
- <template #addons>
- <Navigation />
- <Pagination />
- </template>
- </Carousel>
- <NuxtLink v-else-if="moreLink" :to="moreLink">
- <img :src="image" alt="image" class="h-100" />
- </NuxtLink>
- <img v-else :src="image" alt="image" class="h-100" @click="emit('moreClick')" />
- </template>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import type { PropType } from 'vue';
- import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
- import TitleDescBlock from './TitleDescBlock.vue';
- import ImageTitleBlock from '@/components/parts/ImageTitleBlock.vue';
- const carousel2Config = {
- itemsToShow: 1,
- mouseWheel: true,
- wrapAround: true
- }
- defineProps({
- title : {
- type: String,
- default: '',
- },
- desc: {
- type: String,
- default: '',
- },
- image: {
- type: String,
- default: '',
- },
- rightItems: {
- type: Object as PropType<Array<{
- title: string,
- desc: string,
- image: string ,
- link?: string,
- }>|null>,
- default: null,
- },
- descLines: {
- type: Number,
- default: 3,
- },
- left: {
- type: Boolean,
- default: false,
- },
- showExpand: {
- type: Boolean,
- default: true,
- },
- showMore: {
- type: Boolean,
- default: true,
- },
- moreLink: {
- type: String,
- default: '',
- },
- })
- const emit = defineEmits([
- "moreClick" , 'rightItemDefaultClick'
- ])
- </script>
- <style lang="scss">
- .main-left-right-box {
- .col {
- position: relative;
- padding: 0!important;
- }
- img {
- max-width: 100%;
- object-fit: cover;
- }
- .TitleDescBlock {
- padding: 25px;
- }
- .ImageTitleBlock {
- height: 100%;
- min-height: 250px;
- }
- }
- </style>
|