axios
- 读取 vue 本地文件
- 文件放在 public目录下面
const readFile = (filePath: string) => {
axios({
url:filePath,
method:"GET",
responseType:"blob"
}).then((response :any)=>{
blob2.value = response.data
})
}
onMounted(() => {
readFile('/file/demo.zip')
// blob2.value = readFile('/demo.yml')
})