vuejs2 获取 return 网络错误
vuejs2 get return network error
我正在尝试使用 vuejs2
访问 prestashop API
<script>
import axios from 'axios'
export default {
data () {
return {
get: [],
errors: []
}
},
created () {
axios({
method: 'get',
url: 'https://myprestashopsite.com/api/categories/?ws_key=J***************Z&filter[id_parent]=5&output_format=JSON'
}).then(response => {
this.get = response.data
})
.catch(e => {
this.errors.push(e)
})
}
}
在 mozilla 的 Web 开发人员控制台中,我看到我的请求 return 200 以及响应中的数据。但是我得到 "Error: Network Error app.js%20line%201266%20%3E%20eval:15:15" catch 作为错误。
我尝试使用另一个 API 并且它起作用了,所以我猜它来自 prestashop api。 (prestashop 版本 1.7.3.0)
有办法解决这个问题吗?
问题好像出在axios上。我必须向服务器添加规则。
我在这个帖子上找到了解决方案:
https://github.com/axios/axios/issues/853
如果我的方法不起作用,还有其他我没有尝试过的解决方案。
我正在尝试使用 vuejs2
访问 prestashop API<script>
import axios from 'axios'
export default {
data () {
return {
get: [],
errors: []
}
},
created () {
axios({
method: 'get',
url: 'https://myprestashopsite.com/api/categories/?ws_key=J***************Z&filter[id_parent]=5&output_format=JSON'
}).then(response => {
this.get = response.data
})
.catch(e => {
this.errors.push(e)
})
}
}
在 mozilla 的 Web 开发人员控制台中,我看到我的请求 return 200 以及响应中的数据。但是我得到 "Error: Network Error app.js%20line%201266%20%3E%20eval:15:15" catch 作为错误。
我尝试使用另一个 API 并且它起作用了,所以我猜它来自 prestashop api。 (prestashop 版本 1.7.3.0)
有办法解决这个问题吗?
问题好像出在axios上。我必须向服务器添加规则。
我在这个帖子上找到了解决方案:
https://github.com/axios/axios/issues/853
如果我的方法不起作用,还有其他我没有尝试过的解决方案。