通过import导入
// 关键代码
import logoPng from '@/static/logo.png';
// 示例
<template>
<view>
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
<swiper-item v-for="(img, index) in swiperImg" :key="index">
<view class="swiper-item">
<image :src="img" mode=""></image>
</view>
</swiper-item>
</swiper>
</view>
</template>
<script setup>
import logoPng from '@/static/logo.png';
import { ref, reactive, onMounted } from 'vue';
const swiperImg = reactive([logoPng, logoPng, logoPng]);
onMounted(() => {
console.log(swiperImg);
});
</script>
<style lang="scss"></style>