- 将JSON文件放在项目的public文件夹下
- 在组件中发请求的URL写为:http://localhost:8080/xxx.json
this.axios.get('http://localhost:8080/city.json')
.then((response) => {
console.log(response.data)
}
})
3.在浏览器中检查是否获取到数据
this.axios.get('http://localhost:8080/city.json')
.then((response) => {
console.log(response.data)
}
})
3.在浏览器中检查是否获取到数据