我正在尝试使用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的控制台中,我看到我的请求返回响应中数据的200。但是我得到了" error : Network app.js%20line%201266%20%3E%20eval:15:15“作为一个错误。
我尝试了另一个api,它成功了,所以我想它来自于预存储API。(店前版1.7.3.0)
有办法解决这个问题吗?
发布于 2018-05-03 14:04:56
这个问题似乎来自于公理。我必须给服务器添加一个规则。
我在这个线程上找到了解决这个问题的方法:
https://github.com/axios/axios/issues/853
如果我的解决方案不起作用,我在这个线程中没有尝试过其他的解决方案。
https://stackoverflow.com/questions/50149944
复制相似问题