123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <div
- :class="[
- 'ImageTitleBlock',
- title ? 'has-title' : '',
- fit? 'fit' : ''
- ]"
- :style="{ backgroundImage: `url('${image}')` }"
- @click="$emit('click')"
- >
- <div class="desc">
- <h5>{{ title }}</h5>
- <p>{{ desc }}</p>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- defineProps({
- title: {
- type: String,
- default: ''
- },
- desc: {
- type: String,
- default: '' ,
- },
- image: {
- type: String,
- default: ''
- },
- fit: {
- type: Boolean,
- default: false
- }
- })
- defineEmits([
- 'click',
- ])
- </script>
- <style lang="scss">
- @use '@/assets/scss/colors.scss' as *;
- .ImageTitleBlock {
- position: relative;
- padding: 24px;
- background-size: cover;
- background-position: top center;
- width: 400px;
- height: 270px;
- margin-right: 24px;
- &.fit {
- width: 100%;
- margin-right: 0;
- }
- &.has-title {
- &::before {
- content: '';
- display: block;
- position: absolute;
- right: 0;
- left: 0;
- bottom: 0;
- height: 120px;
- background: linear-gradient(
- 180deg,
- rgba(#000, 0) 0%,
- rgba(#000, 0.7) 100%
- )
- }
- }
- .desc {
- position: absolute;
- right: 0;
- left: 0;
- bottom: 0;
- display: flex;
- flex-direction: column;
- padding: 24px;
- color: #fff;
- h5 {
- font-family: SourceHanSerifCNBold;
- font-size: 1.1rem;
- margin-bottom: 5px;
- }
- p {
- font-size: 0.8rem;
- margin: 0;
- }
- }
- }
- </style>
|