1👍
If it’s on local, you cannot get it with Axios using path. You can import your local file directly
import jsondata from '../your-data.json'
Axios only can do network request, so if your json path are on /public/data.json
. You can request it like this
const response = await axios('http://localhost:3000/public/data.json')
0👍
You can put your json into project’s public static directory, your json file locates at ~project/public/data/data.json
, request like this
axios.get("/data/data.json", {
baseURL: "/",
})
- [Vuejs]-How to dynamic change vue component props in js
- [Vuejs]-Laravel + VUE, works on locally but not in Server
Source:stackexchange.com