【发布时间】:2020-12-13 00:46:53
【问题描述】:
我在我的 vue 应用程序中设置默认标题,但是当我加载应用程序时它显示错误。
main.js?56d7:14 Uncaught TypeError: Cannot read property 'defaults' of undefined
代码
const token = sessionStorage.getItem("token");
if (token) {
Vue.prototype.$http.defaults.header.common["Authorization"] = token;
}
【问题讨论】:
标签: vue.js