之前在Vue2中使用require来获取
let imgs = reactive([
require('@/assets/img/index/index1.jpg'),
require('@/assets/img/index/index2.jpg'),
require('@/assets/img/index/index3.jpg'),
require('@/assets/img/index/index4.jpg'),
require('@/assets/img/index/index5.jpg'),
require('@/assets/img/index/index6.jpg'),
require('@/assets/img/index/index7.jpg'),
require('@/assets/img/index/index8.jpg')
])
但是在vue3中报错了~~~ require is not defined
然后想使用vue3中的import.meta.glob 动态导入试试,发现还是不行,404
let imgs = reactive([
import.meta.glob('../../assets/img/index/*')['../