Answer the question
In order to leave comments, you need to log in
vue-cli. axios not seeing json file?
The code:
async created(){
try {
const response = await axios.get("/proj/public/server/data.json")
console.log(response)
} catch (error) {
console.log(error)
}
}
Answer the question
In order to leave comments, you need to log in
Need to import json file
const data = require("/proj/public/server/data.json");
async created(){
try {
const response = await axios.get(data)
console.log(response)
} catch (error) {
console.log(error)
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question