schangxiang@126.com
2025-05-21 496f78c085e7f8c5ba261835f9b8bda99c25b4cb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
  PropType,
  SetupContext,
  computed,
  defineComponent,
  nextTick,
  onMounted,
  ref,
} from 'vue'
export default defineComponent({
  name: '图片',
  props: {
    picList: {
      type: Object as PropType<string[]>,
      default: () => [],
    },
    height: {
      type: String,
      default: '578px',
    },
  },
  setup(props, { attrs }: SetupContext) {
    onMounted(async () => {})
    const arrow = computed(() => {
      return props.picList.length > 2 ? 'always' : 'never'
    })
    return () => (
      <el-carousel height={props.height} arrow={arrow.value}>
        {props.picList.map((item) => {
          return (
            <el-carousel-item>
              <el-image
                style="width: 100%; height: 100%"
                src={item}
                fit="contain"
              />
            </el-carousel-item>
          )
        })}
      </el-carousel>
    )
  },
})