<template> <div class="longYW"> <div class="partTitleHM">宣传培训</div> <div class="ConstrucClass"> <!-- <Vue3SeamlessScroll :list="tableData" :singleHeight="110" :singleWaitTime="1500" :hover="true" class="scroll"> --> <div class="PublicityContent" v-for="item in tableData" @click="zpClck(item)"> <div class="PublicityContentZP"> <img v-if="item.filelist.length > 0" :src="item.filelist[0].url" alt="" class="zp" /> <p v-else>暂无照片</p> </div> <div class="PublicityContentlR"> <div class="PublicityContentXM" :title="item.address"> <span>{{ item.address }}</span> </div> <div class="PublicityContentTime"> <span>发布时间</span> <span>{{ item.trainTime }}</span> </div> </div> </div> <!-- </Vue3SeamlessScroll> --> </div> </div> </template> <script setup> import { Vue3SeamlessScroll } from 'vue3-seamless-scroll'; import { specialNavList } from '@/api/publicService/index'; const { proxy } = getCurrentInstance(); const tableData = ref([]); const allData = reactive({ queryParams: { pageNum: 1, pageSize: 10, }, }); const { queryParams } = toRefs(allData); // 照片点击 function zpClck(val) { if (val.linkUrl != '') { window.open(val.linkUrl); } else { proxy.$modal.msgWarning('请添加链接地址'); } } /** 获取查询数据列表 */ function getDataList() { specialNavList().then(response => { tableData.value = response.data; console.log(tableData.value, ' tableData.value '); }); } onMounted(() => { getDataList(); }); </script> <style lang="scss" scoped> .longYW { margin-top: 10px; width: 460px; height: 30%; background: #004565; opacity: 0.8; .ConstrucClass { height: calc(100% - 18%); overflow: hidden; overflow-y: auto; // background: red; .scroll { margin-top: 5px; width: 100%; height: calc(100% - 10%); overflow: hidden; display: inline-block; } } .PublicityContent { margin: 5px; width: 97%; height: 90px; background: #325ca3c4; position: relative; display: flex; cursor: pointer; .PublicityContentZP { width: 25%; height: 90px; // background: red; display: flex; align-items: center; /* 垂直居中 */ justify-content: center; /* 水平居中 */ .zp { width: 100px; height: 80px; } } .PublicityContentlR { width: 75%; height: 90px; margin-left: 5px; // background: yellow; .PublicityContentXM { width: 100%; height: 60%; display: flex; align-items: center; span { height: 60%; font-size: 16px; color: #e4f5ff; overflow: hidden; white-space: nowrap; /* 防止文字换行 */ text-overflow: ellipsis; /* 超出部分显示省略号 */ } } .PublicityContentTime { width: 100%; height: 40%; font-family: Source Han Sans CN; font-weight: 400; font-size: 14px; color: #5b93eb; } } } } </style>