因为viti 不支持 require引入会发生报错
<li v-for="(item, index) in data.previewList"
:key="index">
<img
:src="
requireImg(
index <= data.PreviewTypes ? item.dark : item.brightUrl
)
"
:title="item.title"
/>
<div>{{ item.title }}</div>
</li>
let requireImg = (params) => {
const path = `../assets/img/home/${params}.png`;
const modules = import.meta.globEager("../assets/img/home/*");
return modules[path].default;
};
previewList: [
{
title: "视频演示",
brightUrl: "video_1",
dark: "video",
},
{
title: "添加实体",
brightUrl: "entity_1",
dark: "entity",
},
{
title: "添加卫星",
brightUrl: "satellite_1",
dark: "satellite(1)",
},
{
title: "添加地面站",
brightUrl: "ground_station_1",
dark: "ground_station2",
},
{
title: "过站分析",
brightUrl: "calculation_1",
dark: "calculation",
},
],