杨磊
2 天以前 87d2fac9c381de99f75ce6c6c39b7d638b980d7e
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
<template>
  <div class="homePage">
    <el-carousel :height="screenheight + 'px'">
      <el-carousel-item v-for="(item, index) in banner" :key="index">
        <div class="bannerBox imgBox">
          <img id="autoHeight" class="bannerImg" :src="item.icon" @click="bannerLink(item)" />
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
 
<script setup>
import { ref, onBeforeMount, inject, reactive, onMounted } from 'vue'
const MG = inject('MG')
 
let screenheight = ref(document.documentElement.clientHeight / 2)
const banner = reactive([])
const getBanner = () => {
  MG.resource
    .getItem({
      path: 'banner\\homeBanner',
      fields: { link: [] },
      paging: { start: 0, size: 9 },
    })
    .then((res) => {
      banner.push(...res.datas)
      console.log(res.datas)
    })
}
onMounted(() => {
  getBanner()
})
</script>
 
<style lang="less" scoped>
.homePage {
  min-width: 1220px;
  min-height: calc(100vh - 61.8%);
  background-color: #fff;
  padding-bottom: 100px;
}
</style>