我有通过npm引入的google-trends-api包。我正和VueJS一起跑步。我尝试使用Vue发出请求,但是我收到以下错误 - No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mydevserver.test' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
我已经尝试在我的mac上的apache上添加标题Header set Access-Control-Allow-Origin“*”到我的虚拟主机块但是我仍然得到错误。
以下是请求标头 -
:authority: trends.google.com
:method: GET
:path: /trends/api/explore?hl=en-US&req=%7B%22comparisonItem%22%3A%5B%7B%22keyword%22%3A%22poly%20mailers%22%2C%22hl%22%3A%22en-US%22%2C%22category%22%3A0%2C%22timezone%22%3A240%2C%22property%22%3A%22%22%2C%22endTime%22%3A%222018-04-08T04%3A54%3A49.617Z%22%2C%22startTime%22%3A%222004-01-01T00%3A00%3A00.000Z%22%2C%22time%22%3A%222004-01-1%202018-04-8%22%7D%5D%2C%22category%22%3A0%2C%22property%22%3A%22%22%7D&tz=240
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
dnt: 1
origin: http://mydevserver.test
save-data: on
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
x-client-data: CIa2yQEIo7bJAQjBtskBCKmdygEIqKPKARiSo8oB
有关如何使其发挥作用的任何想法?