如何在vue-cli中设置HTTP标头?

问题描述 投票:0回答:1

我想在vue-cli中设置自定义标题。

vue的版本为2.5.2。

我尝试过:

Vue.http.headers.common['Cache-Control'] = 'no-cache, no-store, must-revalidate'

但返回:

Uncaught TypeError: Cannot read property 'headers' of undefined
http vue.js header vue-cli
1个回答
0
投票
我认为您需要安装vue-resource或vue-axios库才能执行此工作并进行REST调用。

请安装并重试。

https://github.com/pagekit/vue-resource

https://github.com/imcvampire/vue-axios

我希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.