我在这个结构中有一个 csv 文件
name,year,href,src
Parasite,2019,parasite-2019,film-poster/4/2/6/4/0/6/426406-parasite-0-460-0-690-crop.jpg
Run Code Online (Sandbox Code Playgroud)
我想将此文件作为列表导入,每行作为字典,如下所示:
name,year,href,src
Parasite,2019,parasite-2019,film-poster/4/2/6/4/0/6/426406-parasite-0-460-0-690-crop.jpg
Run Code Online (Sandbox Code Playgroud)
我尝试在标签import csv from './filmList.csv'内部使用<script>,但这只会在加载时给我一个错误:
[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .csv file format.
Run Code Online (Sandbox Code Playgroud)