| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <Touchable
- touchable
- v-bind="props"
- :flexShrink="0"
- :innerStyle="{ borderRadius: theme.resolveThemeSize(radius), overflow: 'hidden', }"
- :width="width"
- @click="$emit('click')"
- >
- <Image
- :src="src"
- :height="imageHeight"
- :radius="imageRadius"
- width="100%"
- round
- mode="aspectFill"
- />
- <slot name="desc">
- <FlexCol :padding="15">
- <IconTextBlock
- :title="title"
- :desc="desc"
- :extra="extra"
- :extraMpSlotState="Boolean($slots.extra)"
- >
- <template v-if="$slots.extra" #extra>
- <slot name="extra" />
- </template>
- </IconTextBlock>
- </FlexCol>
- </slot>
- </Touchable>
- </template>
- <script lang="ts">
- /**
- * 组件说明:图片块2。
- *
- * 该组件可以用于显示图片,支持在图片下方显示描述。
- *
- * 该组件的默认高度为 200rpx。
- */
- export default {}
- </script>
- <script setup lang="ts">
- import { useTheme } from '@/components/theme/ThemeDefine';
- import Image from '../../basic/Image.vue';
- import Touchable from '@/components/feedback/Touchable.vue';
- import type { FlexProps } from '../../layout/FlexView.vue';
- import IconTextBlock from './IconTextBlock.vue';
- import FlexCol from '@/components/layout/FlexCol.vue';
- export interface ImageBlock2Props extends Partial<FlexProps> {
- /**
- * 宽度。
- */
- width?: string | number;
- /**
- * 高度。
- */
- imageHeight?: string | number;
- /**
- * 图片的路径。
- */
- src?: string;
- /**
- * 图片的圆角。
- */
- imageRadius?: string | number;
- /**
- * 图片下方显示标题。
- */
- title?: string;
- /**
- * 图片下方显示描述。
- */
- desc?: string;
- /**
- * 图片下方显示额外信息。
- */
- extra?: string;
- }
- const theme = useTheme();
- const props = withDefaults(defineProps<ImageBlock2Props>(), {
- width: 400,
- imageHeight: 250,
- imageRadius: 0,
- direction: 'column',
- backgroundColor: "white",
- overflow: "hidden",
- })
- defineEmits([
- "click"
- ])
- </script>
- <style lang="scss">
- .nana-image-desc {
- color: #fff;
- font-size: 25rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- </style>
|